消除编译警告.

Signed-off-by: rick.chan <chenyang@autoai.com>
This commit is contained in:
rick.chan 2020-06-10 16:00:57 +08:00
parent b8c62c06de
commit 16a2889826
2 changed files with 8 additions and 6 deletions

View File

@ -7,8 +7,7 @@ LOCAL_MODULE_RELATIVE_PATH := $(TARGET_OUT_SHARED_LIBRARIIES)/hw
LOCAL_MODULE_TAGS := optional
LOCAL_PRELINK_MODULE := false
LOCAL_VENDOR_MODULE := true
LOCAL_LDLIBS := -llog
LOCAL_SHARED_LIBRARIES := libhardware libcutils libutils
LOCAL_SHARED_LIBRARIES := libhardware libcutils libutils liblog
LOCAL_SRC_FILES := miccom.c
include $(BUILD_SHARED_LIBRARY)

View File

@ -11,11 +11,10 @@
#define LOG_TAG "MiccomStub"
#include <hardware/hardware.h>
#include <utils/Log.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <cutils/log.h>
#include <cutils/atomic.h>
#include <string.h>
#include <stdlib.h>
#include "miccom.h"
@ -24,6 +23,8 @@
#define MODULE_NAME "Miccom"
#define MODULE_AUTHOR "chenyang@auotai.com"
#define UNUSED(x) ((void)(x))
static int miccom_device_open(const struct hw_module_t* module, const char* name, struct hw_device_t** device);
static int miccom_device_close(struct hw_device_t* device);
static int miccom_set_reg(struct miccom_device_t* dev, char reg, unsigned char num);
@ -49,7 +50,8 @@ static int miccom_device_open(const struct hw_module_t* module, const char* name
{
struct miccom_device_t* dev;
dev = (struct hw_device_t*)malloc(sizeof(*dev));
UNUSED(name);
dev = (struct miccom_device_t*)malloc(sizeof(*dev));
if(!dev) {
ALOGE("Miccom stub: failed to alloc space.");
return -EFAULT;
@ -63,7 +65,8 @@ static int miccom_device_open(const struct hw_module_t* module, const char* name
dev->set_reg = miccom_set_reg;
dev->get_reg = miccom_get_reg;
if(dev->fd = open(DEVICE_NAME, O_RDWR) == -1) {
dev->fd = open(DEVICE_NAME, O_RDWR);
if(dev->fd == -1) {
ALOGE("Miccom stub: failed to open "DEVICE_NAME" -- %s.", strerror(errno));
free(dev);
return -EFAULT;