summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAswath Govindraju <a-govindraju@ti.com>2021-03-25 12:48:47 +0530
committerPeng Fan <peng.fan@nxp.com>2021-04-06 18:36:27 +0800
commit2153a08a24e807f229e492037ed81ca27c2e0c11 (patch)
tree9114c9e2b04ce39a98b5fd55e2fc78bc41b8b88c
parent1fc9346af4256e2e33fc39f65c6006e04cddd806 (diff)
downloadu-boot-2153a08a24e807f229e492037ed81ca27c2e0c11.tar.gz
mmc: Check for device with a seq number equal to num before checking against index
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>
-rw-r--r--drivers/mmc/mmc.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index b4c8e7f293..1e83007286 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -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)