diff options
| author | juncao <juncao@codeaurora.org> | 2015-12-02 13:32:36 +0800 |
|---|---|---|
| committer | venkata Jagadeesh <vjagad@codeaurora.org> | 2015-12-30 19:08:03 +0530 |
| commit | e9b87a1eaa3da3fe40706314cfa3fe1ae2f0de86 (patch) | |
| tree | ba80fbc6f6a210d9c5a1e85e3d77100903f90301 | |
| parent | 1d3ae3f104211c426928b278bd8f613edc0ac8d2 (diff) | |
| download | android_hardware_qcom_bt-e9b87a1eaa3da3fe40706314cfa3fe1ae2f0de86.tar.gz android_hardware_qcom_bt-e9b87a1eaa3da3fe40706314cfa3fe1ae2f0de86.tar.bz2 android_hardware_qcom_bt-e9b87a1eaa3da3fe40706314cfa3fe1ae2f0de86.zip | |
Bluetooth: Fix the build warnings in libbt-vendor
There are some warings while build libbt-vendor, such as
mis-mach, passing argument, wrong return value, uninitialized
variable,unused parameter,etc. Revised to more strict to
avoid build warnings.
Change-Id: I1336e2c38713896972a27ab68b15ff695d9a3b53
CRs-Fixed: 945937
| -rw-r--r-- | libbt-vendor/src/bt_vendor_qcom.c | 23 | ||||
| -rw-r--r-- | libbt-vendor/src/hci_uart.c | 6 | ||||
| -rw-r--r-- | libbt-vendor/src/hw_ar3k.c | 6 | ||||
| -rw-r--r-- | libbt-vendor/src/hw_rome.c | 7 |
4 files changed, 29 insertions, 13 deletions
diff --git a/libbt-vendor/src/bt_vendor_qcom.c b/libbt-vendor/src/bt_vendor_qcom.c index c388d8a..15901bb 100644 --- a/libbt-vendor/src/bt_vendor_qcom.c +++ b/libbt-vendor/src/bt_vendor_qcom.c @@ -331,7 +331,7 @@ static int bt_powerup(int en ) { char rfkill_type[64], *enable_ldo_path = NULL; char type[16], enable_ldo[6]; - int fd, size, i, ret, fd_ldo; + int fd = 0, size, i, ret, fd_ldo; char disable[PROPERTY_VALUE_MAX]; char state; @@ -435,14 +435,17 @@ static int bt_powerup(int en ) ALOGE("Write %c to rfkill\n", on); /* Write value to control rfkill */ - if ((size = write(fd, &on, 1)) < 0) { - ALOGE("write(%s) failed: %s (%d)",rfkill_state, strerror(errno),errno); + if(fd >= 0) { + if ((size = write(fd, &on, 1)) < 0) { + ALOGE("write(%s) failed: %s (%d)",rfkill_state, strerror(errno),errno); #ifdef WIFI_BT_STATUS_SYNC - bt_semaphore_release(lock_fd); - bt_semaphore_destroy(lock_fd); + bt_semaphore_release(lock_fd); + bt_semaphore_destroy(lock_fd); #endif - return -1; + return -1; + } } + #ifdef BT_SOC_TYPE_ROME if(on == '0'){ ALOGE("Stopping HCI filter as part of CTRL:OFF"); @@ -645,9 +648,10 @@ static int op(bt_vendor_opcode_t opcode, void *param) char* tok; #endif bool skip_init = true; + int opcode_init = opcode; ALOGV("bt-vendor : op for %d", opcode); - switch(opcode) + switch(opcode_init) { case BT_VND_OP_POWER_CTRL: { @@ -722,7 +726,6 @@ static int op(bt_vendor_opcode_t opcode, void *param) is_ant_req = true; //fall through #endif - #endif case BT_VND_OP_USERIAL_OPEN: { @@ -838,7 +841,7 @@ static int op(bt_vendor_opcode_t opcode, void *param) /* Since the BD address is configured in boot time We should not be here */ ALOGI("Failed to read BD address. Use the one from bluedroid stack/ftm"); } - if(rome_soc_init(fd,vnd_local_bd_addr)<0) { + if(rome_soc_init(fd, (char*)vnd_local_bd_addr)<0) { retval = -1; userial_clock_operation(fd, USERIAL_OP_CLK_OFF); } else { @@ -1076,7 +1079,7 @@ static void ssr_cleanup(int reason) { if ((btSocType = get_bt_soc_type()) < 0) { ALOGE("%s: Failed to detect BT SOC Type", __FUNCTION__); - return -1; + return; } if (btSocType == BT_SOC_ROME) { diff --git a/libbt-vendor/src/hci_uart.c b/libbt-vendor/src/hci_uart.c index 8c636cf..92afdf0 100644 --- a/libbt-vendor/src/hci_uart.c +++ b/libbt-vendor/src/hci_uart.c @@ -49,6 +49,8 @@ #define VNDUSERIALDBG(param, ...) {} #endif +#define RESERVED(p) if(p) ALOGI( "%s: reserved param", __FUNCTION__); + /****************************************************************************** ** Global variables ******************************************************************************/ @@ -391,7 +393,7 @@ int userial_vendor_get_baud(void) *******************************************************************************/ int userial_vendor_ioctl(userial_vendor_ioctl_op_t op, int *p_data) { - int err; + int err = -1; switch(op) { @@ -442,6 +444,8 @@ int userial_vendor_ioctl(userial_vendor_ioctl_op_t op, int *p_data) *******************************************************************************/ int userial_set_port(char *p_conf_name, char *p_conf_value, int param) { + RESERVED(p_conf_name); + RESERVED(param); strlcpy(vnd_userial.port_name, p_conf_value, VND_PORT_NAME_MAXLEN); return 0; diff --git a/libbt-vendor/src/hw_ar3k.c b/libbt-vendor/src/hw_ar3k.c index 2f6da66..b1d50ab 100644 --- a/libbt-vendor/src/hw_ar3k.c +++ b/libbt-vendor/src/hw_ar3k.c @@ -96,6 +96,8 @@ struct ps_cfg_entry ps_list[MAX_TAGS]; } #endif +#define RESERVED(p) if(p) ALOGI( "%s: reserved param", __FUNCTION__); + /***************************************************************************** ** Functions *****************************************************************************/ @@ -874,6 +876,8 @@ static int set_patch_ram(int dev, char *patch_loc, int len) uint8_t *event; uint8_t *loc_ptr = &cmd[7]; + RESERVED(len); + if (!patch_loc) return -1; @@ -1387,6 +1391,8 @@ void lpm_set_ar3k(uint8_t pio, uint8_t action, uint8_t polarity) ALOGI("lpm mode: %d action: %d", pio, action); + RESERVED(polarity); + switch (pio) { case UPIO_LPM_MODE: diff --git a/libbt-vendor/src/hw_rome.c b/libbt-vendor/src/hw_rome.c index 3df11ba..08291ad 100644 --- a/libbt-vendor/src/hw_rome.c +++ b/libbt-vendor/src/hw_rome.c @@ -60,6 +60,8 @@ extern "C" { } #endif +#define RESERVED(p) if(p) ALOGI( "%s: reserved param", __FUNCTION__); + int read_vs_hci_event(int fd, unsigned char* buf, int size); /****************************************************************************** @@ -971,7 +973,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc int rome_tlv_dnld_req(int fd, int tlv_size) { int total_segment, remain_size, i, err = -1; - unsigned char wait_cc_evt; + unsigned char wait_cc_evt = TRUE; total_segment = tlv_size/MAX_SIZE_PER_TLV_SEGMENT; remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\ @@ -1687,7 +1689,7 @@ int check_embedded_mode(int fd) { return wipower_flag; } -int rome_get_addon_feature_list(fd) { +int rome_get_addon_feature_list(int fd) { int err = 0; /* Get addon features that are supported by FW */ @@ -1798,6 +1800,7 @@ int rome_soc_init(int fd, char *bdaddr) int err = -1, size = 0; dnld_fd = fd; ALOGI(" %s ", __FUNCTION__); + RESERVED(bdaddr); /* If wipower charging is going on in embedded mode then start hand off req */ if (wipower_flag == WIPOWER_IN_EMBEDDED_MODE && wipower_handoff_ready != NON_WIPOWER_MODE) |
