diff --git a/fm_hci/fm_hci.c b/fm_hci/fm_hci.c index 47932955a5732dff3ae316c2b302d5f916ace90f..74c0ac9bb8ef02d8fdd5d4215e3e38667cba3a90 100644 --- a/fm_hci/fm_hci.c +++ b/fm_hci/fm_hci.c @@ -268,12 +268,14 @@ static int read_fm_event(struct fm_hci_t *hci, struct fm_event_header_t *pbuf, i static void *hci_read_thread(void *arg) { - int length; + int length = 0; struct fm_hci_t *hci = (struct fm_hci_t *)arg; struct fm_event_header_t *evt_buf = (struct fm_event_header_t *) malloc(sizeof(struct fm_event_header_t) + MAX_FM_EVT_PARAMS); - length = read_fm_event(hci, evt_buf, sizeof(struct fm_event_header_t) + MAX_FM_EVT_PARAMS); + if (!evt_buf) + length = read_fm_event(hci, evt_buf, sizeof(struct fm_event_header_t) + MAX_FM_EVT_PARAMS); + ALOGD("length=%d\n",length); if(length <=0) { lib_running =0; diff --git a/fmhalService/main.c b/fmhalService/main.c index 558f681539f4cd4ca3dcbf465413123019e55147..6647f8b4a03ffe5855fff63b53c93bad6a542114 100644 --- a/fmhalService/main.c +++ b/fmhalService/main.c @@ -342,7 +342,7 @@ void vnd_load_if() int main() { fd_set client_fds; - int retval, n; + int retval = -1, n; ALOGI("%s: Entry ", __func__); ALOGI("FM HAL SERVICE: Loading the WCNSS HAL library..."); diff --git a/helium/radio_helium_hal.c b/helium/radio_helium_hal.c index f22c6f56b86f221e23dbb5ac4c44729388973dd5..a45fd48da8a070fb91f4d5b59b65762d9d576107 100644 --- a/helium/radio_helium_hal.c +++ b/helium/radio_helium_hal.c @@ -323,7 +323,7 @@ static void hci_cc_default_data_write_rsp(char *ev_buff) static void hci_cc_get_blend_tbl_rsp(char *ev_buff) { - int status, val; + int status, val = -1; if (ev_buff == NULL) { ALOGE("%s:response buffer in null", LOG_TAG); @@ -360,11 +360,13 @@ static void hci_cc_set_blend_tbl_rsp(char *ev_buff) static void hci_cc_station_rsp(char *ev_buff) { - int val, status = ev_buff[0]; + int val = -1, status = ev_buff[0]; + unsigned char *tmp = (unsigned char *)(&hal->radio->fm_st_rsp.station_rsp) + + sizeof(char); if (status == FM_HC_STATUS_SUCCESS) { - memcpy(&hal->radio->fm_st_rsp.station_rsp.station_freq, &ev_buff[1], - sizeof(struct hci_fm_station_rsp) - sizeof(char)); + memcpy(tmp, &ev_buff[1], + sizeof(struct hci_ev_tune_status) - sizeof(char)); if (test_bit(station_param_mask_flag, CMD_STNPARAM_RSSI)) { val = hal->radio->fm_st_rsp.station_rsp.rssi; } else if (test_bit(station_param_mask_flag, CMD_STNPARAM_SINR)) { @@ -379,7 +381,7 @@ static void hci_cc_station_rsp(char *ev_buff) static void hci_cc_dbg_param_rsp(char *ev_buff) { - int val, status = ev_buff[0]; + int val = -1, status = ev_buff[0]; if (status == FM_HC_STATUS_SUCCESS) { memcpy(&hal->radio->st_dbg_param, &ev_buff[1], @@ -652,8 +654,10 @@ static inline void hci_ev_radio_text(char *buff) data[3] = buff[RDS_PID_HIGHER]; data[4] = buff[RT_A_B_FLAG_OFFSET]; - memcpy(data+RDS_OFFSET, &buff[RDS_OFFSET], len); - data[len+RDS_OFFSET] = 0x00; + if (len > 0) { + memcpy(data+RDS_OFFSET, &buff[RDS_OFFSET], len); + data[len+RDS_OFFSET] = 0x00; + } hal->jni_cb->rt_update_cb(data); free(data);