[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180419155958.GA18593@embeddedor.com>
Date: Thu, 19 Apr 2018 10:59:58 -0500
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Masahiro Yamada <yamada.masahiro@...ionext.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Ulf Hansson <ulf.hansson@...aro.org>
Cc: linux-mmc <linux-mmc@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: [PATCH v2] mmc: sdhci-cadence: fix logically and structurally dead
code
Currently, the code block inside the for loop will never execute
more than once, because the function returns inmediately after
the first iteration, hence the execution of the code at the second
iteration is structurally dead and, code at line 281: return 0; is
never reached.
Fix this by checking _ret_ before return.
Addresses-Coverity-ID: 1468009 ("Logically dead code")
Addresses-Coverity-ID: 1468002 ("Structurally dead code")
Suggested-by: Masahiro Yamada <yamada.masahiro@...ionext.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>
---
Changes in v2:
- Update changelog.
- Drop the 'Fixes' tag.
- Add check on ret instead of removing the "return ret;" line.
- Thanks to Masahiro Yamada for the feedback provided.
drivers/mmc/host/sdhci-cadence.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
index bc30d16..7a343b8 100644
--- a/drivers/mmc/host/sdhci-cadence.c
+++ b/drivers/mmc/host/sdhci-cadence.c
@@ -274,8 +274,8 @@ static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val)
ret = readl_poll_timeout(reg, tmp,
!(tmp & SDHCI_CDNS_HRS06_TUNE_UP),
0, 1);
-
- return ret;
+ if (ret)
+ return ret;
}
return 0;
--
2.7.4
Powered by blists - more mailing lists