fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/34809?usp=email )


Change subject: mobile: fix mncc_get_bearer(): return -1 straightaway
......................................................................

mobile: fix mncc_get_bearer(): return -1 straightaway

Even though the function works as expected and *can* return -1,
which is first casted to unsigned and then back to signed, let's
make the code less confusing by returning -1 straightaway.

Change-Id: I3206fcfa9ab4cac85a1f0f2a4de3250b25f9058f
Related: OS#4396
---
M src/host/layer23/src/mobile/mnccms.c
1 file changed, 20 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/09/34809/1

diff --git a/src/host/layer23/src/mobile/mnccms.c 
b/src/host/layer23/src/mobile/mnccms.c
index b173946..be43afa 100644
--- a/src/host/layer23/src/mobile/mnccms.c
+++ b/src/host/layer23/src/mobile/mnccms.c
@@ -90,7 +90,7 @@
                        LOGP(DMNCC, LOGL_INFO, " net suggests full rate v3\n");
                else {
                        LOGP(DMNCC, LOGL_INFO, " full rate v3 not supported\n");
-                       speech_ver = -1;
+                       return -1;
                }
                break;
        case GSM48_BCAP_SV_EFR:
@@ -98,7 +98,7 @@
                        LOGP(DMNCC, LOGL_INFO, " net suggests full rate v2\n");
                else {
                        LOGP(DMNCC, LOGL_INFO, " full rate v2 not supported\n");
-                       speech_ver = -1;
+                       return -1;
                }
                break;
        case GSM48_BCAP_SV_FR: /* mandatory */
@@ -106,7 +106,7 @@
                        LOGP(DMNCC, LOGL_INFO, " net suggests full rate v1\n");
                else {
                        LOGP(DMNCC, LOGL_INFO, " full rate v1 not supported\n");
-                       speech_ver = -1;
+                       return -1;
                }
                break;
        case GSM48_BCAP_SV_AMR_H:
@@ -114,7 +114,7 @@
                        LOGP(DMNCC, LOGL_INFO, " net suggests half rate v3\n");
                else {
                        LOGP(DMNCC, LOGL_INFO, " half rate v3 not supported\n");
-                       speech_ver = -1;
+                       return -1;
                }
                break;
        case GSM48_BCAP_SV_HR:
@@ -122,13 +122,13 @@
                        LOGP(DMNCC, LOGL_INFO, " net suggests half rate v1\n");
                else {
                        LOGP(DMNCC, LOGL_INFO, " half rate v1 not supported\n");
-                       speech_ver = -1;
+                       return -1;
                }
                break;
        default:
                LOGP(DMNCC, LOGL_INFO, " net suggests unknown speech version "
                        "%d\n", speech_ver);
-               speech_ver = -1;
+               return -1;
        }

        return speech_ver;

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/34809?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I3206fcfa9ab4cac85a1f0f2a4de3250b25f9058f
Gerrit-Change-Number: 34809
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-MessageType: newchange

Reply via email to