From: Aswath Govindraju Date: Thu, 25 Mar 2021 07:18:47 +0000 (+0530) Subject: mmc: Check for device with a seq number equal to num before checking against index X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=2153a08a24e807f229e492037ed81ca27c2e0c11;p=u-boot.git 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 Reviewed-by: Lokesh Vutla Reviewed-by: Jaehoon Chung --- 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)