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
This commit is contained in:
Ben Chan
2019-07-26 17:04:30 -07:00
parent d7696d8ec1
commit 500844af73

View File

@@ -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;