[MERGED] osmo-iuh[master]: Fix various compiler warnings in hnb-gw code
Harald Welte has submitted this change and it was merged. Change subject: Fix various compiler warnings in hnb-gw code .. Fix various compiler warnings in hnb-gw code Since we finally started to use -Wall, the related warnings became visible. Change-Id: I516700eab2aa7c3412dd62775c4960aed9d4b682 --- M src/context_map.c M src/hnbgw.c M src/hnbgw_cn.c M src/hnbgw_hnbap.c M src/hnbgw_ranap.c M src/hnbgw_rua.c M src/hnbgw_vty.c M src/iu_client.c M src/ranap_common_cn.c 9 files changed, 62 insertions(+), 77 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/context_map.c b/src/context_map.c index 0960cb9..b90f555 100644 --- a/src/context_map.c +++ b/src/context_map.c @@ -169,4 +169,6 @@ context_map_tmr.cb = context_map_tmr_cb; context_map_tmr.data = gw; osmo_timer_schedule(_map_tmr, EXPIRY_TIMER_SECS, 0); + + return 0; } diff --git a/src/hnbgw.c b/src/hnbgw.c index 97905b3..5c0570e 100644 --- a/src/hnbgw.c +++ b/src/hnbgw.c @@ -44,8 +44,11 @@ #include #include +#include #include + +#include #include #include @@ -68,8 +71,6 @@ void *talloc_asn1_ctx; static struct hnb_gw *g_hnb_gw; - -static int listen_fd_cb(struct osmo_fd *fd, unsigned int what); static struct hnb_gw *hnb_gw_create(void *ctx) { @@ -175,13 +176,13 @@ } static int hnb_close_cb(struct osmo_stream_srv *conn) { + return 0; } static int hnb_read_cb(struct osmo_stream_srv *conn) { struct hnb_context *hnb = osmo_stream_srv_get_data(conn); struct msgb *msg = msgb_alloc(IUH_MSGB_SIZE, "Iuh rx"); - int flags = 0; int rc; if (!msg) @@ -222,12 +223,12 @@ case IUH_PPI_SABP: case IUH_PPI_RNA: case IUH_PPI_PUA: - LOGP(DMAIN, LOGL_ERROR, "Unimplemented SCTP PPID=%u received\n", + LOGP(DMAIN, LOGL_ERROR, "Unimplemented SCTP PPID=%lu received\n", msgb_sctp_ppid(msg)); rc = 0; break; default: - LOGP(DMAIN, LOGL_ERROR, "Unknown SCTP PPID=%u received\n", + LOGP(DMAIN, LOGL_ERROR, "Unknown SCTP PPID=%lu received\n", msgb_sctp_ppid(msg)); rc = 0; break; @@ -421,8 +422,6 @@ int main(int argc, char **argv) { - struct osmo_sccp_user *sccp_user; - struct osmo_sccp_link *sua_link; struct osmo_stream_srv_link *srv; int rc; diff --git a/src/hnbgw_cn.c b/src/hnbgw_cn.c index 3238f00..a48b651 100644 --- a/src/hnbgw_cn.c +++ b/src/hnbgw_cn.c @@ -38,13 +38,12 @@ * Outbound RANAP RESET to CN ***/ -int hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state); +void hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state); static int transmit_rst(struct hnb_gw *gw, RANAP_CN_DomainIndicator_t domain, struct osmo_sccp_addr *remote_addr) { struct msgb *msg; - struct msgb *msgprim; RANAP_Cause_t cause = { .present = RANAP_Cause_PR_transmissionNetwork, .choice. transmissionNetwork = RANAP_CauseTransmissionNetwork_signalling_transport_resource_failure, @@ -71,7 +70,7 @@ } /* change the state of a CN Link */ -int hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state) +void hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state) { switch (state) { case CNLINK_S_NULL: @@ -127,9 +126,11 @@ struct hnb_gw *gw = cnlink->gw; struct hnb_context *hnb; RANAP_PagingIEs_t ies; - int rc = 0; + int rc; rc = ranap_decode_pagingies(, >value); + if (rc < 0) + return rc; /* FIXME: determine which HNBs to send this Paging command, * rather than broadcasting to all HNBs */ @@ -145,8 +146,6 @@ RANAP_InitiatingMessage_t *imsg, const uint8_t *data, unsigned int len) { - int rc; - switch (imsg->procedureCode) { case RANAP_ProcedureCode_id_Reset: return cn_ranap_rx_reset_cmd(cnlink, imsg); @@ -161,11 +160,11 @@ case RANAP_ProcedureCode_id_DirectInformationTransfer: case RANAP_ProcedureCode_id_UplinkInformationExchange: LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " -"Procedure %u from CN, ignoring\n", imsg->procedureCode); +"Procedure %ld from CN, ignoring\n", imsg->procedureCode); break; default: LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP " -"Procedure %u from CN, ignoring\n", imsg->procedureCode); +
osmo-iuh[master]: Fix various compiler warnings in hnb-gw code
Patch Set 2: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/4945 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I516700eab2aa7c3412dd62775c4960aed9d4b682 Gerrit-PatchSet: 2 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Harald WelteGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: No
[PATCH] osmo-iuh[master]: Fix various compiler warnings in hnb-gw code
Hello Harald Welte, Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/4945 to look at the new patch set (#2). Fix various compiler warnings in hnb-gw code Since we finally started to use -Wall, the related warnings became visible. Change-Id: I516700eab2aa7c3412dd62775c4960aed9d4b682 --- M src/context_map.c M src/hnbgw.c M src/hnbgw_cn.c M src/hnbgw_hnbap.c M src/hnbgw_ranap.c M src/hnbgw_rua.c M src/hnbgw_vty.c M src/iu_client.c M src/ranap_common_cn.c 9 files changed, 62 insertions(+), 77 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/45/4945/2 diff --git a/src/context_map.c b/src/context_map.c index 0960cb9..b90f555 100644 --- a/src/context_map.c +++ b/src/context_map.c @@ -169,4 +169,6 @@ context_map_tmr.cb = context_map_tmr_cb; context_map_tmr.data = gw; osmo_timer_schedule(_map_tmr, EXPIRY_TIMER_SECS, 0); + + return 0; } diff --git a/src/hnbgw.c b/src/hnbgw.c index 97905b3..5c0570e 100644 --- a/src/hnbgw.c +++ b/src/hnbgw.c @@ -44,8 +44,11 @@ #include #include +#include #include + +#include #include #include @@ -68,8 +71,6 @@ void *talloc_asn1_ctx; static struct hnb_gw *g_hnb_gw; - -static int listen_fd_cb(struct osmo_fd *fd, unsigned int what); static struct hnb_gw *hnb_gw_create(void *ctx) { @@ -175,13 +176,13 @@ } static int hnb_close_cb(struct osmo_stream_srv *conn) { + return 0; } static int hnb_read_cb(struct osmo_stream_srv *conn) { struct hnb_context *hnb = osmo_stream_srv_get_data(conn); struct msgb *msg = msgb_alloc(IUH_MSGB_SIZE, "Iuh rx"); - int flags = 0; int rc; if (!msg) @@ -222,12 +223,12 @@ case IUH_PPI_SABP: case IUH_PPI_RNA: case IUH_PPI_PUA: - LOGP(DMAIN, LOGL_ERROR, "Unimplemented SCTP PPID=%u received\n", + LOGP(DMAIN, LOGL_ERROR, "Unimplemented SCTP PPID=%lu received\n", msgb_sctp_ppid(msg)); rc = 0; break; default: - LOGP(DMAIN, LOGL_ERROR, "Unknown SCTP PPID=%u received\n", + LOGP(DMAIN, LOGL_ERROR, "Unknown SCTP PPID=%lu received\n", msgb_sctp_ppid(msg)); rc = 0; break; @@ -421,8 +422,6 @@ int main(int argc, char **argv) { - struct osmo_sccp_user *sccp_user; - struct osmo_sccp_link *sua_link; struct osmo_stream_srv_link *srv; int rc; diff --git a/src/hnbgw_cn.c b/src/hnbgw_cn.c index 3238f00..a48b651 100644 --- a/src/hnbgw_cn.c +++ b/src/hnbgw_cn.c @@ -38,13 +38,12 @@ * Outbound RANAP RESET to CN ***/ -int hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state); +void hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state); static int transmit_rst(struct hnb_gw *gw, RANAP_CN_DomainIndicator_t domain, struct osmo_sccp_addr *remote_addr) { struct msgb *msg; - struct msgb *msgprim; RANAP_Cause_t cause = { .present = RANAP_Cause_PR_transmissionNetwork, .choice. transmissionNetwork = RANAP_CauseTransmissionNetwork_signalling_transport_resource_failure, @@ -71,7 +70,7 @@ } /* change the state of a CN Link */ -int hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state) +void hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state) { switch (state) { case CNLINK_S_NULL: @@ -127,9 +126,11 @@ struct hnb_gw *gw = cnlink->gw; struct hnb_context *hnb; RANAP_PagingIEs_t ies; - int rc = 0; + int rc; rc = ranap_decode_pagingies(, >value); + if (rc < 0) + return rc; /* FIXME: determine which HNBs to send this Paging command, * rather than broadcasting to all HNBs */ @@ -145,8 +146,6 @@ RANAP_InitiatingMessage_t *imsg, const uint8_t *data, unsigned int len) { - int rc; - switch (imsg->procedureCode) { case RANAP_ProcedureCode_id_Reset: return cn_ranap_rx_reset_cmd(cnlink, imsg); @@ -161,11 +160,11 @@ case RANAP_ProcedureCode_id_DirectInformationTransfer: case RANAP_ProcedureCode_id_UplinkInformationExchange: LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " -"Procedure %u from CN, ignoring\n", imsg->procedureCode); +"Procedure %ld from CN, ignoring\n", imsg->procedureCode); break; default: LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP " -"Procedure %u from CN, ignoring\n", imsg->procedureCode); +"Procedure %ld from CN,
osmo-iuh[master]: Fix various compiler warnings in hnb-gw code
Patch Set 1: Code-Review-1 (1 comment) https://gerrit.osmocom.org/#/c/4945/1/src/hnbgw_hnbap.c File src/hnbgw_hnbap.c: Line 358: DEBUGP(DHNBAP, "HNB-DE-REGISTER cause=%ld\n", %s -- To view, visit https://gerrit.osmocom.org/4945 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I516700eab2aa7c3412dd62775c4960aed9d4b682 Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Harald WelteGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-HasComments: Yes
osmo-iuh[master]: Fix various compiler warnings in hnb-gw code
Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/4945 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I516700eab2aa7c3412dd62775c4960aed9d4b682 Gerrit-PatchSet: 1 Gerrit-Project: osmo-iuh Gerrit-Branch: master Gerrit-Owner: Harald WelteGerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] osmo-iuh[master]: Fix various compiler warnings in hnb-gw code
Review at https://gerrit.osmocom.org/4945 Fix various compiler warnings in hnb-gw code Since we finally started to use -Wall, the related warnings became visible. Change-Id: I516700eab2aa7c3412dd62775c4960aed9d4b682 --- M src/context_map.c M src/hnbgw.c M src/hnbgw_cn.c M src/hnbgw_hnbap.c M src/hnbgw_ranap.c M src/hnbgw_rua.c M src/hnbgw_vty.c M src/iu_client.c M src/ranap_common_cn.c 9 files changed, 61 insertions(+), 76 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/45/4945/1 diff --git a/src/context_map.c b/src/context_map.c index 0960cb9..b90f555 100644 --- a/src/context_map.c +++ b/src/context_map.c @@ -169,4 +169,6 @@ context_map_tmr.cb = context_map_tmr_cb; context_map_tmr.data = gw; osmo_timer_schedule(_map_tmr, EXPIRY_TIMER_SECS, 0); + + return 0; } diff --git a/src/hnbgw.c b/src/hnbgw.c index 97905b3..5c0570e 100644 --- a/src/hnbgw.c +++ b/src/hnbgw.c @@ -44,8 +44,11 @@ #include #include +#include #include + +#include #include #include @@ -68,8 +71,6 @@ void *talloc_asn1_ctx; static struct hnb_gw *g_hnb_gw; - -static int listen_fd_cb(struct osmo_fd *fd, unsigned int what); static struct hnb_gw *hnb_gw_create(void *ctx) { @@ -175,13 +176,13 @@ } static int hnb_close_cb(struct osmo_stream_srv *conn) { + return 0; } static int hnb_read_cb(struct osmo_stream_srv *conn) { struct hnb_context *hnb = osmo_stream_srv_get_data(conn); struct msgb *msg = msgb_alloc(IUH_MSGB_SIZE, "Iuh rx"); - int flags = 0; int rc; if (!msg) @@ -222,12 +223,12 @@ case IUH_PPI_SABP: case IUH_PPI_RNA: case IUH_PPI_PUA: - LOGP(DMAIN, LOGL_ERROR, "Unimplemented SCTP PPID=%u received\n", + LOGP(DMAIN, LOGL_ERROR, "Unimplemented SCTP PPID=%lu received\n", msgb_sctp_ppid(msg)); rc = 0; break; default: - LOGP(DMAIN, LOGL_ERROR, "Unknown SCTP PPID=%u received\n", + LOGP(DMAIN, LOGL_ERROR, "Unknown SCTP PPID=%lu received\n", msgb_sctp_ppid(msg)); rc = 0; break; @@ -421,8 +422,6 @@ int main(int argc, char **argv) { - struct osmo_sccp_user *sccp_user; - struct osmo_sccp_link *sua_link; struct osmo_stream_srv_link *srv; int rc; diff --git a/src/hnbgw_cn.c b/src/hnbgw_cn.c index 3238f00..a48b651 100644 --- a/src/hnbgw_cn.c +++ b/src/hnbgw_cn.c @@ -38,13 +38,12 @@ * Outbound RANAP RESET to CN ***/ -int hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state); +void hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state); static int transmit_rst(struct hnb_gw *gw, RANAP_CN_DomainIndicator_t domain, struct osmo_sccp_addr *remote_addr) { struct msgb *msg; - struct msgb *msgprim; RANAP_Cause_t cause = { .present = RANAP_Cause_PR_transmissionNetwork, .choice. transmissionNetwork = RANAP_CauseTransmissionNetwork_signalling_transport_resource_failure, @@ -71,7 +70,7 @@ } /* change the state of a CN Link */ -int hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state) +void hnbgw_cnlink_change_state(struct hnbgw_cnlink *cnlink, enum hnbgw_cnlink_state state) { switch (state) { case CNLINK_S_NULL: @@ -127,9 +126,11 @@ struct hnb_gw *gw = cnlink->gw; struct hnb_context *hnb; RANAP_PagingIEs_t ies; - int rc = 0; + int rc; rc = ranap_decode_pagingies(, >value); + if (rc < 0) + return rc; /* FIXME: determine which HNBs to send this Paging command, * rather than broadcasting to all HNBs */ @@ -145,8 +146,6 @@ RANAP_InitiatingMessage_t *imsg, const uint8_t *data, unsigned int len) { - int rc; - switch (imsg->procedureCode) { case RANAP_ProcedureCode_id_Reset: return cn_ranap_rx_reset_cmd(cnlink, imsg); @@ -161,11 +160,11 @@ case RANAP_ProcedureCode_id_DirectInformationTransfer: case RANAP_ProcedureCode_id_UplinkInformationExchange: LOGP(DRANAP, LOGL_NOTICE, "Received unsupported RANAP " -"Procedure %u from CN, ignoring\n", imsg->procedureCode); +"Procedure %ld from CN, ignoring\n", imsg->procedureCode); break; default: LOGP(DRANAP, LOGL_NOTICE, "Received suspicious RANAP " -"Procedure %u from CN, ignoring\n", imsg->procedureCode); +"Procedure %ld from CN, ignoring\n", imsg->procedureCode); break; } return 0; @@ -174,8 +173,6 @@ static int