]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: Fix static checker warnings
authorVenkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Thu, 29 Sep 2022 04:52:49 +0000 (10:22 +0530)
committerJaehoon Chung <jh80.chung@samsung.com>
Mon, 24 Oct 2022 09:02:54 +0000 (18:02 +0900)
Correct pointer dereferencing check to be more consistent.

Eliminate the below smatch warning:
drivers/mmc/mmc.c:3118 mmc_init_device()
warn: variable dereferenced before check 'm' (see line 3116)

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/mmc/mmc.c

index 0b7c0be8cbc2a2ad6a10229dbc6f11b3c6ad5a32..210703ea46b32325c9c1853a9a1e4e2c30362f88 100644 (file)
@@ -3113,10 +3113,12 @@ int mmc_init_device(int num)
        }
 
        m = mmc_get_mmc_dev(dev);
-       m->user_speed_mode = MMC_MODES_END; /* Initialising user set speed mode */
-
        if (!m)
                return 0;
+
+       /* Initialising user set speed mode */
+       m->user_speed_mode = MMC_MODES_END;
+
        if (m->preinit)
                mmc_start_init(m);