From 79f83553346377433c7ef2c38551bfb5e54df50e Mon Sep 17 00:00:00 2001 From: Jarkko Paso Date: Tue, 19 Nov 2019 15:15:12 +0200 Subject: [PATCH] Fixed compilation warnings --- .../sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.c | 8 ++++---- .../source/DHCPv6_Server/DHCPv6_Server_service.c | 2 +- .../source/MAC/IEEE802_15_4/mac_mcps_sap.c | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.c b/features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.c index f620e4d574..44ae29e955 100644 --- a/features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.c +++ b/features/nanostack/sal-stack-nanostack/source/6LoWPAN/ws/ws_bootstrap.c @@ -1189,7 +1189,7 @@ static void ws_bootstrap_pan_advertisement_solicit_analyse(struct protocol_inter if (ws_bootstrap_state_discovery(cur) && cur->bootsrap_state_machine_cnt > cur->ws_info->trickle_params_pan_discovery.Imin + 50) { cur->bootsrap_state_machine_cnt = cur->ws_info->trickle_params_pan_discovery.Imin + randLIB_get_8bit() % 50; - tr_info("Making parent selection in %d s", (uint32_t)(cur->bootsrap_state_machine_cnt / 10)); + tr_info("Making parent selection in %u s", (cur->bootsrap_state_machine_cnt / 10)); } } @@ -2294,7 +2294,7 @@ static void ws_bootstrap_start_discovery(protocol_interface_info_entry_t *cur) cur->ws_info->trickle_pan_advertisement_solicit.I, cur->ws_info->trickle_pan_advertisement_solicit.t, cur->ws_info->trickle_pan_advertisement_solicit.now, cur->ws_info->trickle_pan_advertisement_solicit.c); cur->bootsrap_state_machine_cnt = time_to_solicit + cur->ws_info->trickle_params_pan_discovery.Imin + randLIB_get_8bit() % 50; - tr_info("Making parent selection in %d s", (uint32_t)(cur->bootsrap_state_machine_cnt / 10)); + tr_info("Making parent selection in %u s", (cur->bootsrap_state_machine_cnt / 10)); } // Start authentication @@ -2355,7 +2355,7 @@ static void ws_bootstrap_authentication_completed(protocol_interface_info_entry_ // Go back for network scanning ws_bootstrap_state_change(cur, ER_ACTIVE_SCAN); cur->bootsrap_state_machine_cnt = randLIB_get_random_in_range(10, cur->ws_info->trickle_params_pan_discovery.Imin >> 1); - tr_info("Making parent selection in %d s", (uint32_t)(cur->bootsrap_state_machine_cnt / 10)); + tr_info("Making parent selection in %u s", (cur->bootsrap_state_machine_cnt / 10)); } else { tr_debug("authentication failed"); // What else to do to start over again... @@ -2727,7 +2727,7 @@ void ws_bootstrap_network_scan_process(protocol_interface_info_entry_t *cur) if (!selected_parent_ptr) { // Next check will be after one trickle cur->bootsrap_state_machine_cnt += cur->ws_info->trickle_params_pan_discovery.Imin + randLIB_get_8bit() % 50; - tr_info("Making parent selection in %d s", (uint32_t)(cur->bootsrap_state_machine_cnt / 10)); + tr_info("Making parent selection in %u s", (cur->bootsrap_state_machine_cnt / 10)); return; } tr_info("selected parent:%s panid %u", trace_array(selected_parent_ptr->addr, 8), selected_parent_ptr->pan_id); diff --git a/features/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_Server_service.c b/features/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_Server_service.c index bd606db11f..c2f567e40f 100644 --- a/features/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_Server_service.c +++ b/features/nanostack/sal-stack-nanostack/source/DHCPv6_Server/DHCPv6_Server_service.c @@ -87,7 +87,7 @@ static void DHCP_server_service_timer_stop(void) int DHCPv6_server_respond_client(dhcpv6_gua_server_entry_s *serverBase, dhcpv6_reply_packet_s *replyPacket, dhcp_ia_non_temporal_params_t *dhcp_ia_non_temporal_params, dhcpv6_gua_response_t *response, bool allocateNew) { - dhcpv6_alloacted_address_entry_t *dhcp_allocated_address; + dhcpv6_alloacted_address_entry_t *dhcp_allocated_address = NULL; dhcpv6_ia_non_temporal_address_s nonTemporalAddress; bool address_allocated = false; //Validate Client DUID diff --git a/features/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.c b/features/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.c index a97570675a..1ea990f2e0 100644 --- a/features/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.c +++ b/features/nanostack/sal-stack-nanostack/source/MAC/IEEE802_15_4/mac_mcps_sap.c @@ -1543,7 +1543,7 @@ static int8_t mcps_generic_packet_build(protocol_interface_rf_mac_setup_s *rf_pt mac_header_information_elements_preparation(buffer); mcps_generic_sequence_number_allocate(rf_ptr, buffer); - mlme_key_descriptor_t *key_desc; + mlme_key_descriptor_t *key_desc = NULL; if (buffer->fcf_dsn.securityEnabled) { bool increment_framecounter = false; //Remember to update security counter here! @@ -1600,7 +1600,7 @@ static int8_t mcps_generic_packet_build(protocol_interface_rf_mac_setup_s *rf_pt tr_debug("Too Long %u, %u pa %u header %u mic %u", frame_length, mac_payload_length, buffer->mac_header_length_with_security, buffer->security_mic_len, dev_driver->phy_MTU); buffer->status = MLME_FRAME_TOO_LONG; //decrement security counter - if (buffer->fcf_dsn.securityEnabled) { + if (key_desc) { mac_sec_mib_key_outgoing_frame_counter_decrement(rf_ptr, key_desc); } return -1; @@ -1716,7 +1716,7 @@ int8_t mcps_generic_ack_build(protocol_interface_rf_mac_setup_s *rf_ptr, bool in ccm_globals_t ccm_ptr; mac_pre_build_frame_t *buffer = &rf_ptr->enhanced_ack_buffer; - mlme_key_descriptor_t *key_desc; + mlme_key_descriptor_t *key_desc = NULL; if (buffer->fcf_dsn.securityEnabled) { //Remember to update security counter here! @@ -1755,7 +1755,7 @@ int8_t mcps_generic_ack_build(protocol_interface_rf_mac_setup_s *rf_ptr, bool in if ((frame_length) > ack_mtu_size - 2) { buffer->status = MLME_FRAME_TOO_LONG; - if (buffer->fcf_dsn.securityEnabled) { + if (key_desc) { //decrement security counter mac_sec_mib_key_outgoing_frame_counter_decrement(rf_ptr, key_desc); ccm_free(&ccm_ptr);