[MERGED] osmo-bts[master]: octphy: initalize l1msg and only when needed

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Jun 28 13:21:52 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: octphy: initalize l1msg and only when needed
......................................................................


octphy: initalize l1msg and only when needed

l1msg is initalized when the variable is declared. This means
the allocation always runs right on the beginning. Even when
the buffer is not needed at all.

do a prober l1msg initalization only when needed and check the
return code.

(Patch by Octasic Inc.)

Change-Id: Ia71d49b9cc109af53d997a687a7fb1b5ed062d1c
---
M src/osmo-bts-octphy/l1_if.c
1 file changed, 9 insertions(+), 1 deletion(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index 85b5a86..9b348a9 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -451,7 +451,7 @@
 {
 	struct phy_instance *pinst = trx_phy_instance(trx);
 	struct octphy_hdl *fl1h = pinst->phy_link->u.octphy.hdl;
-	struct msgb *l1msg = l1p_msgb_alloc();
+	struct msgb *l1msg = NULL;
 	uint32_t u32Fn;
 	uint8_t u8Tn, subCh, sapi = 0;
 	uint8_t chan_nr, link_id;
@@ -510,6 +510,14 @@
 
 	if (len) {
 		/* create new PHY primitive in l1msg, copying payload */
+
+		l1msg = l1p_msgb_alloc();
+		if (!l1msg) {
+			LOGP(DL1C, LOGL_FATAL, "L1SAP PH-DATA.req msg alloc failed\n");
+			rc = -ENOMEM;
+			goto done;
+		}
+
 		tOCTVC1_GSM_MSG_TRX_REQUEST_LOGICAL_CHANNEL_DATA_CMD *data_req =
 			(tOCTVC1_GSM_MSG_TRX_REQUEST_LOGICAL_CHANNEL_DATA_CMD *)
 				msgb_put(l1msg, sizeof(*data_req));

-- 
To view, visit https://gerrit.osmocom.org/3057
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia71d49b9cc109af53d997a687a7fb1b5ed062d1c
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list