From 53d54c4a712ef440580c8a6b3802c6cd06ddf6d2 Mon Sep 17 00:00:00 2001 From: Yifeng Zhao Date: Wed, 16 Aug 2023 09:46:33 +0800 Subject: [PATCH] mmc: dw_mmc-rockchip: fix tuning return incorrect value in certain situations When V2 tuning returns an error, it is necessary to reset the ret to 0, otherwise the incorrect value will be returned. log: [ 4.935664] mmc0: tuning execution failed: -5 Fixes: 795e052cc861 ("mmc: dw_mmc-rockchip: add v2 tuning support") Signed-off-by: Yifeng Zhao Change-Id: I54a77e02255d88114191e8abc434856b34768715 --- drivers/mmc/host/dw_mmc-rockchip.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/dw_mmc-rockchip.c b/drivers/mmc/host/dw_mmc-rockchip.c index 69970381d0e7..a88e8f1af052 100644 --- a/drivers/mmc/host/dw_mmc-rockchip.c +++ b/drivers/mmc/host/dw_mmc-rockchip.c @@ -174,7 +174,7 @@ static int dw_mci_v2_execute_tuning(struct dw_mci_slot *slot, u32 opcode) } if (i == ARRAY_SIZE(degrees)) { - dev_warn(host->dev, "All phases bad!"); + dev_warn(host->dev, "V2 All phases bad!"); return -EIO; } @@ -208,8 +208,7 @@ static int dw_mci_rk3288_execute_tuning(struct dw_mci_slot *slot, u32 opcode) } if (priv->use_v2_tuning) { - ret = dw_mci_v2_execute_tuning(slot, opcode); - if (!ret) + if (!dw_mci_v2_execute_tuning(slot, opcode)) return 0; /* Otherwise we continue using fine tuning */ }