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

Aleksander Morgado aleksander at aleksander.es
Fri Aug 10 09:07:02 UTC 2018


On 10/08/18 02:00, Ben Chan wrote:
> 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
> ---

Ooops, thanks for that one.
Pushed to git master

>  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,
> 


-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list