[PATCH] broadband-modem: initialize 'tac' in registration_status_check_ready()

Ben Chan benchan at chromium.org
Fri Aug 10 00:00:27 UTC 2018


mm-broadband-modem.c:4395:13: error: variable 'tac' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
        if (act == MM_MODEM_ACCESS_TECHNOLOGY_LTE) {
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm-broadband-modem.c:4407:75: note: uninitialized use occurs here
    mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, tac, cid);
                                                                          ^~~
mm-broadband-modem.c:4395:9: note: remove the 'if' if its condition is always true
        if (act == MM_MODEM_ACCESS_TECHNOLOGY_LTE) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm-broadband-modem.c:4380:9: error: variable 'tac' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
    if (cgreg) {
        ^~~~~
mm-broadband-modem.c:4407:75: note: uninitialized use occurs here
    mm_iface_modem_3gpp_update_location (MM_IFACE_MODEM_3GPP (self), lac, tac, cid);
                                                                          ^~~
mm-broadband-modem.c:4380:5: note: remove the 'if' if its condition is always false
    if (cgreg) {
    ^~~~~~~~~~~~
mm-broadband-modem.c:4280:15: note: initialize the variable 'tac' to silence this warning
    gulong tac;
              ^
               = 0
---
 src/mm-broadband-modem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c
index a685e407..d1afba4d 100644
--- a/src/mm-broadband-modem.c
+++ b/src/mm-broadband-modem.c
@@ -4344,6 +4344,7 @@ registration_status_check_ready (MMBroadbandModem *self,
     cereg = FALSE;
     state = MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN;
     act = MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN;
+    tac = 0;
     lac = 0;
     cid = 0;
     parsed = mm_3gpp_parse_creg_response (match_info,
-- 
2.18.0.597.ga71716f1ad-goog



More information about the ModemManager-devel mailing list