mmc: dw_mmc-starfive: Fix initialization of prev_err
authorWilliam Qiu <william.qiu@starfivetech.com>
Tue, 7 Mar 2023 02:46:46 +0000 (10:46 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Thu, 9 Mar 2023 14:33:51 +0000 (15:33 +0100)
Fix a bug by making sure prev_err doesn't get used when being
uninitialized.

Signed-off-by: William Qiu <william.qiu@starfivetech.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
Fixes: 9e622229bbf4 ("mmc: starfive: Add sdio/emmc driver support")
Link: https://lore.kernel.org/r/20230307024646.10216-3-william.qiu@starfivetech.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/dw_mmc-starfive.c

index 40f5969..dab1508 100644 (file)
@@ -51,7 +51,7 @@ static int dw_mci_starfive_execute_tuning(struct dw_mci_slot *slot,
        struct dw_mci *host = slot->host;
        struct starfive_priv *priv = host->priv;
        int rise_point = -1, fall_point = -1;
-       int err, prev_err;
+       int err, prev_err = 0;
        int i;
        bool found = 0;
        u32 regval;