fix warnings/bugs reported by eclipse static analyzer

This commit is contained in:
Matthias Ringwald 2016-10-19 10:49:33 +02:00
parent cd4b342469
commit 202c8a4c4c
6 changed files with 22 additions and 15 deletions

View File

@ -64,6 +64,7 @@ static void att_packet_handler(uint8_t packet_type, uint16_t handle, uint8_t *pa
if (!att_server_handler) return;
att_server_handler(packet_type, handle, packet, size);
}
break;
case HCI_EVENT_PACKET:
if (packet[0] != L2CAP_EVENT_CAN_SEND_NOW) break;
if (att_server_handler && att_server_waiting_for_can_send){

View File

@ -547,6 +547,7 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
hfp_connection = get_hfp_connection_context_for_bd_addr(event_addr);
if (!hfp_connection) break;
hfp_connection->hf_accept_sco = 1;
break;
default:
break;
}

View File

@ -797,6 +797,7 @@ static int hfp_ag_run_for_context_service_level_connection_queries(hfp_connectio
hfp_ag_report_extended_audio_gateway_error(hfp_connection->rfcomm_cid, hfp_connection->extended_audio_gateway_error_value);
return 1;
}
break;
case HFP_CMD_ENABLE_INDICATOR_STATUS_UPDATE:
hfp_ag_ok(hfp_connection->rfcomm_cid);
return 1;
@ -1330,7 +1331,8 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
hfp_gsm_handle_event(HFP_AG_TERMINATE_CALL_BY_HF);
hfp_ag_set_callsetup_indicator();
hfp_ag_transfer_callsetup_state();
log_info("AG terminate outgoing call process");
log_info("AG terminate outgoing call process");
break;
default:
break;
}
@ -1358,6 +1360,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * hfp_con
default:
break;
}
break;
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
hfp_gsm_handle_event(HFP_AG_TERMINATE_CALL_BY_AG);
hfp_ag_set_callsetup_indicator();

View File

@ -1095,6 +1095,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
break;
case HCI_EVENT_PACKET:
hfp_handle_hci_event(packet_type, channel, packet, size);
break;
default:
break;
}

View File

@ -883,7 +883,7 @@ static void hci_initialization_timeout_handler(btstack_timer_source_t * ds){
if (hci_stack->hci_transport->reset_link){
hci_stack->hci_transport->reset_link();
}
// NOTE: explicit fallthrough to HCI_INIT_W4_CUSTOM_INIT_CSR_WARM_BOOT
// no break - explicit fallthrough to HCI_INIT_W4_CUSTOM_INIT_CSR_WARM_BOOT
case HCI_INIT_W4_CUSTOM_INIT_CSR_WARM_BOOT:
log_info("Resend HCI Reset - CSR Warm Boot");
hci_stack->substate = HCI_INIT_SEND_RESET_CSR_WARM_BOOT;
@ -1928,6 +1928,7 @@ static void packet_handler(uint8_t packet_type, uint8_t *packet, uint16_t size){
break;
case HCI_SCO_DATA_PACKET:
sco_handler(packet, size);
break;
default:
break;
}
@ -2797,7 +2798,7 @@ static void hci_run(void){
hci_stack->substate = HCI_FALLING_ASLEEP_W4_WRITE_SCAN_ENABLE;
break;
}
// fall through for ble-only chips
// no break - fall through for ble-only chips
case HCI_FALLING_ASLEEP_COMPLETE:
log_info("HCI_STATE_HALTING, calling sleep");

View File

@ -580,23 +580,23 @@ static void l2cap_run(void){
case INFORMATION_REQUEST:
switch (infoType){
case 1: { // Connectionless MTU
uint16_t connectionless_mtu = hci_max_acl_data_packet_length();
l2cap_send_signaling_packet(handle, INFORMATION_RESPONSE, sig_id, infoType, 0, sizeof(connectionless_mtu), &connectionless_mtu);
uint16_t connectionless_mtu = hci_max_acl_data_packet_length();
l2cap_send_signaling_packet(handle, INFORMATION_RESPONSE, sig_id, infoType, 0, sizeof(connectionless_mtu), &connectionless_mtu);
}
break;
}
case 2: { // Extended Features Supported
// extended features request supported, features: fixed channels, unicast connectionless data reception
uint32_t features = 0x280;
l2cap_send_signaling_packet(handle, INFORMATION_RESPONSE, sig_id, infoType, 0, sizeof(features), &features);
// extended features request supported, features: fixed channels, unicast connectionless data reception
uint32_t features = 0x280;
l2cap_send_signaling_packet(handle, INFORMATION_RESPONSE, sig_id, infoType, 0, sizeof(features), &features);
}
break;
}
case 3: { // Fixed Channels Supported
uint8_t map[8];
memset(map, 0, 8);
map[0] = 0x06; // L2CAP Signaling Channel (0x02) + Connectionless reception (0x04)
l2cap_send_signaling_packet(handle, INFORMATION_RESPONSE, sig_id, infoType, 0, sizeof(map), &map);
uint8_t map[8];
memset(map, 0, 8);
map[0] = 0x06; // L2CAP Signaling Channel (0x02) + Connectionless reception (0x04)
l2cap_send_signaling_packet(handle, INFORMATION_RESPONSE, sig_id, infoType, 0, sizeof(map), &map);
}
break;
}
default:
// all other types are not supported
l2cap_send_signaling_packet(handle, INFORMATION_RESPONSE, sig_id, infoType, 1, 0, NULL);