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
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 @@
{
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 @@
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 @@
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 @@
is_ant_req = true;
//fall through
#endif
-
#endif
case BT_VND_OP_USERIAL_OPEN:
{
@@ -838,7 +841,7 @@
/* 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 @@
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_ioctl(userial_vendor_ioctl_op_t op, int *p_data)
{
- int err;
+ int err = -1;
switch(op)
{
@@ -442,6 +444,8 @@
*******************************************************************************/
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 @@
}
#endif
+#define RESERVED(p) if(p) ALOGI( "%s: reserved param", __FUNCTION__);
+
/*****************************************************************************
** Functions
*****************************************************************************/
@@ -874,6 +876,8 @@
uint8_t *event;
uint8_t *loc_ptr = &cmd[7];
+ RESERVED(len);
+
if (!patch_loc)
return -1;
@@ -1387,6 +1391,8 @@
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 @@
}
#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_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 @@
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 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)