]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: Check for device with a seq number equal to num before checking against index
authorAswath Govindraju <a-govindraju@ti.com>
Thu, 25 Mar 2021 07:18:47 +0000 (12:48 +0530)
committerPeng Fan <peng.fan@nxp.com>
Tue, 6 Apr 2021 10:36:27 +0000 (18:36 +0800)
First check if there is an alias for the device tree node defined with the
given num before checking against device index.

Signed-off-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/mmc/mmc.c

index b4c8e7f293bde2e30d6d9f453815c26c8c3e596a..1e83007286b2e73833fea8c4c2a50ec93fb193d3 100644 (file)
@@ -3052,9 +3052,11 @@ int mmc_init_device(int num)
        struct mmc *m;
        int ret;
 
-       ret = uclass_get_device(UCLASS_MMC, num, &dev);
-       if (ret)
-               return ret;
+       if (uclass_get_device_by_seq(UCLASS_MMC, num, &dev)) {
+               ret = uclass_get_device(UCLASS_MMC, num, &dev);
+               if (ret)
+                       return ret;
+       }
 
        m = mmc_get_mmc_dev(dev);
        if (!m)