From 500844af73a9a707794fc0694218d80f0514d2b8 Mon Sep 17 00:00:00 2001 From: Ben Chan Date: Fri, 26 Jul 2019 17:04:30 -0700 Subject: [PATCH] shared-qmi: fix potentially uninitialized 'mcc' variable mm-shared-qmi.c:358:9: error: variable 'mcc' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized] if (operator_id && !mm_3gpp_parse_operator_id (operator_id, &mcc, &mnc, &error)) { ^~~~~~~~~~~ mm-shared-qmi.c:367:9: note: uninitialized use occurs here if (mcc) { ^~~ mm-shared-qmi.c:358:9: note: remove the '&&' if its condition is always true if (operator_id && !mm_3gpp_parse_operator_id (operator_id, &mcc, &mnc, &error)) { ^~~~~~~~~~~~~~ mm-shared-qmi.c:339:51: note: initialize the variable 'mcc' to silence this warning guint16 mcc; ^ = 0 --- src/mm-shared-qmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mm-shared-qmi.c b/src/mm-shared-qmi.c index d03c309e..9629fab7 100644 --- a/src/mm-shared-qmi.c +++ b/src/mm-shared-qmi.c @@ -336,7 +336,7 @@ mm_shared_qmi_3gpp_register_in_network (MMIfaceModem3gpp *self, GTask *task; RegisterInNetworkContext *ctx; QmiMessageNasInitiateNetworkRegisterInput *input; - guint16 mcc; + guint16 mcc = 0; guint16 mnc; QmiClient *client = NULL; GError *error = NULL;