diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-10-25 11:09:26 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-10-25 11:11:51 +0200 |
commit | 9e1cd5a5a5a431f30d4b418ef8f688d992814141 (patch) | |
tree | f3963981ce22a9f64d2100f4a89c7149f5dd601f /src | |
parent | 726e2729fa264fa3221e567b42c49f2007a369fb (diff) |
gprs: Address coverity warning for gprs_ns_tx_status result
Add a #define for the check and use this in this path as well.
Fixes: Coverity CID 1103092
Diffstat (limited to 'src')
-rw-r--r-- | src/gb/gprs_ns.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c index 5fd287b0..0e9156a3 100644 --- a/src/gb/gprs_ns.c +++ b/src/gb/gprs_ns.c @@ -126,6 +126,12 @@ static const struct rate_ctr_group_desc nsvc_ctrg_desc = { .ctr_desc = nsvc_ctr_description, }; +#define CHECK_TX_RC(rc, nsvc) \ + if (rc < 0) \ + LOGP(DNS, LOGL_ERROR, "TX failed (%d) to peer %s\n", \ + rc, gprs_ns_ll_str(nsvc)); + + /*! \brief Lookup struct gprs_nsvc based on NSVCI * \param[in] nsi NS instance in which to search * \param[in] nsvci NSVCI to be searched @@ -804,10 +810,7 @@ static int gprs_ns_rx_reset(struct gprs_nsvc **nsvc, struct msgb *msg) NS_IE_NSEI); rate_ctr_inc(&(*nsvc)->ctrg->ctr[NS_CTR_INV_NSEI]); rc = gprs_ns_tx_reset_ack(*nsvc); - if (rc < 0) - LOGP(DNS, LOGL_ERROR, "TX failed (%d) to peer %s\n", - rc, gprs_ns_ll_str(*nsvc)); - + CHECK_TX_RC(rc, *nsvc); return 0; } @@ -865,9 +868,7 @@ static int gprs_ns_rx_reset_ack(struct gprs_nsvc **nsvc, struct msgb *msg) !TLVP_PRESENT(&tp, NS_IE_NSEI)) { LOGP(DNS, LOGL_ERROR, "NS RESET ACK Missing mandatory IE\n"); rc = gprs_ns_tx_status(*nsvc, NS_CAUSE_MISSING_ESSENT_IE, 0, msg); - if (rc < 0) - LOGP(DNS, LOGL_ERROR, "TX failed (%d) to peer %s\n", - rc, gprs_ns_ll_str(*nsvc)); + CHECK_TX_RC(rc, *nsvc); return -EINVAL; } @@ -1163,8 +1164,9 @@ int gprs_ns_vc_create(struct gprs_ns_inst *nsi, struct msgb *msg, if (!TLVP_PRESENT(&tp, NS_IE_CAUSE) || !TLVP_PRESENT(&tp, NS_IE_VCI) || !TLVP_PRESENT(&tp, NS_IE_NSEI)) { LOGP(DNS, LOGL_ERROR, "NS RESET Missing mandatory IE\n"); - gprs_ns_tx_status(fallback_nsvc, NS_CAUSE_MISSING_ESSENT_IE, 0, + rc = gprs_ns_tx_status(fallback_nsvc, NS_CAUSE_MISSING_ESSENT_IE, 0, msg); + CHECK_TX_RC(rc, fallback_nsvc); return -EINVAL; } nsvci = ntohs(*(uint16_t *) TLVP_VAL(&tp, NS_IE_VCI)); |