Project

General

Profile

Actions

Bug #2859

closed

Compilation warning: variable is_lu set but not used

Added by pespin over 6 years ago. Updated about 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
01/22/2018
Due date:
% Done:

0%

Spec Reference:

Description

commit 6082a377f57901302816a2e57e75a3f262b7b7e6 in osmo-bsc (most probably from openbsc time since it's from 2013), change code in src/libbsc/abis_rsl.c function rsl_rx_chan_rqd:

commit 6082a377f57901302816a2e57e75a3f262b7b7e6
Author: Andreas Eversberg <jolly@eversberg.eu>
Date:   Fri May 31 15:05:52 2013 +0200

    HO: Assign SDCCH on channel request

    This is needed, so channel can be negotiated before the actual channel
    type is assigned.

    In case there is no SDCCH available, try to assign what ever the MS requested.
    If this is not possible try to assign TCH/F. If this is still not possible,
    reject channel request.

    Change-Id: I10fc9f60c58c6b7ed424a86ce23bf6b9802c9eb1

diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c
index 980b3e66..64e5c92c 100644
--- a/src/libbsc/abis_rsl.c
+++ b/src/libbsc/abis_rsl.c
@@ -1890,8 +1890,26 @@ static int rsl_rx_chan_rqd(struct msgb *msg)
         */
        is_lu = !!(chreq_reason == GSM_CHREQ_REASON_LOCATION_UPD);

-       /* check availability / allocate channel */
-       lchan = lchan_alloc(bts, lctype, is_lu);
+       /* check availability / allocate channel
+        *
+        * - First try to allocate SDCCH.
+        * - If SDCCH is not available, try whatever MS requested, if not SDCCH.
+        * - If there is still no channel available, reject channel request.
+        *
+        * lchan_alloc() possibly tries to allocate larger lchans.
+        *
+        * Note: If the MS requests not TCH/H, we don't know if the phone
+        *       supports TCH/H, so we must assign TCH/F or SDCCH.
+        */
+       lchan = lchan_alloc(bts, GSM_LCHAN_SDCCH, 0);
+       if (!lchan && lctype != GSM_LCHAN_SDCCH) {
+               LOGP(DRSL, LOGL_NOTICE, "BTS %d CHAN RQD: no resources for %s " 
+                       "0x%x, retrying with %s\n",
+                       msg->lchan->ts->trx->bts->nr,
+                       gsm_lchant_name(GSM_LCHAN_SDCCH), rqd_ref->ra,
+                       gsm_lchant_name(lctype));
+               lchan = lchan_alloc(bts, lctype, 0);
+       }

With that change, the variable is_lu stopped being used and now compiler warning warns about the variable being set but not used. Did the patch forget to drop the unused variable or should the is_lu var be passed as parameter to lchan_alloc as it used to do before the patch?

Actions #1

Updated by fixeria about 6 years ago

  • Assignee changed from jolly to neels

Neels is doing HO related work now, so I changed assignee.

Actions #2

Updated by stsp about 6 years ago

I just found this during unrelated code reading and discussed it with Harald.

The intention of the original code was to use a "bigger" channel if is_lu is set, i.e. respond to location updates via
e.g. a TCH_H or TCH_F channel if the SDCCH channel is not available. Our discussion determined that this is a question
of channel allocation policy, and that the new code added in 6082a377f57901302816a2e57e75a3f262b7b7e6 is fine as it is.

I submitted a patch which removes the is_lu variable: https://gerrit.osmocom.org/#/c/6064/

Actions #3

Updated by neels about 6 years ago

  • Assignee changed from neels to stsp

stsp, looks like your patch was merged, can you reflect on it and resolve this issue if appropriate...

Actions #4

Updated by stsp about 6 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)