In case mmc_complete_init() returns error, exit from mmc_init()
without possibly calling cyclic_register(), which at that point
would be undesired.

Signed-off-by: Marek Vasut <[email protected]>
---
Cc: Heinrich Schuchardt <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Kever Yang <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Ronald Wahl <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tim Harvey <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Venkatesh Yadav Abbarapu <[email protected]>
Cc: [email protected]
---
 drivers/mmc/mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 0d0bda5dd35..4ea97974383 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -3073,8 +3073,10 @@ int mmc_init(struct mmc *mmc)
 
        if (!err)
                err = mmc_complete_init(mmc);
-       if (err)
+       if (err) {
                pr_info("%s: %d, time %lu\n", __func__, err, get_timer(start));
+               return err;
+       }
 
        if (CONFIG_IS_ENABLED(CYCLIC, (!mmc->cyclic.func), (NULL))) {
                /* Register cyclic function for card detect polling */
-- 
2.45.2

Reply via email to