Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/13698


Change subject: common/oml.c: refactor OML msgb allocation in oml_tx_attr_resp()
......................................................................

common/oml.c: refactor OML msgb allocation in oml_tx_attr_resp()

There is no need to allocate a new OML message buffer before
handing the list of requested attributes.

Change-Id: Ib8c1f77aad784b6f5cbe888a5139d7afb456924d
---
M src/common/oml.c
1 file changed, 5 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/98/13698/1

diff --git a/src/common/oml.c b/src/common/oml.c
index 80d424f..df85fbe 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -255,16 +255,13 @@
 static int oml_tx_attr_resp(struct gsm_bts *bts, const struct abis_om_fom_hdr 
*foh, const uint8_t *attr,
                            uint16_t attr_len)
 {
-       struct msgb *nmsg = oml_msgb_alloc();
+       struct msgb *nmsg;
        uint8_t resp[MAX_VERSION_LENGTH * attr_len * 2]; /* heuristic for 
Attribute Response Info space requirements */
        int len;

        LOGP(DOML, LOGL_INFO, "%s Tx Get Attribute Response\n",
             get_value_string(abis_nm_obj_class_names, foh->obj_class));

-       if (!nmsg)
-               return -NM_NACK_CANT_PERFORM;
-
        switch (foh->obj_class) {
        case NM_OC_BTS:
                len = handle_attrs_bts(resp, bts, attr, attr_len);
@@ -280,10 +277,13 @@

        if (len < 0) {
                LOGP(DOML, LOGL_ERROR, "Tx Get Attribute Response FAILED with 
%d\n", len);
-               msgb_free(nmsg);
                return len;
        }

+       nmsg = oml_msgb_alloc();
+       if (!nmsg)
+               return -NM_NACK_CANT_PERFORM;
+
        /* ยง9.4.64 Get Attribute Response Info */
        msgb_tl16v_put(nmsg, NM_ATT_GET_ARI, len, resp);


--
To view, visit https://gerrit.osmocom.org/13698
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib8c1f77aad784b6f5cbe888a5139d7afb456924d
Gerrit-Change-Number: 13698
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <[email protected]>

Reply via email to