From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aswath Govindraju Date: Thu, 25 Mar 2021 12:48:47 +0530 Subject: [PATCH v2 1/2] mmc: Check for device with a seq number equal to num before checking against index In-Reply-To: <20210325071848.27181-1-a-govindraju@ti.com> References: <20210325071848.27181-1-a-govindraju@ti.com> Message-ID: <20210325071848.27181-2-a-govindraju@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- drivers/mmc/mmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index b4c8e7f293bd..1e83007286b2 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) -- 2.17.1