From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Masahiro Yamada <yamada.masahiro@socionext.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH] mmc: sdhci-cadence: fix logically and structurally dead code
Date: Thu, 19 Apr 2018 08:53:16 -0500 [thread overview]
Message-ID: <20180419135316.GA14790@embeddedor.com> (raw)
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.
Based on the code comments, it seems that the actual intention is
to execute the code inside the for loop twice instead of once.
So, fix this issue by removing the return statement inside the for
loop and replace the "return 0" with "return ret".
Addresses-Coverity-ID: 1468009 ("Logically dead code")
Addresses-Coverity-ID: 1468002 ("Structurally dead code")
Fixes: 213fae74318b ("mmc: sdhci-cadence: send tune request twice to
work around errata")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/mmc/host/sdhci-cadence.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c
index bc30d16..facbad8 100644
--- a/drivers/mmc/host/sdhci-cadence.c
+++ b/drivers/mmc/host/sdhci-cadence.c
@@ -275,10 +275,9 @@ static int sdhci_cdns_set_tune_val(struct sdhci_host *host, unsigned int val)
!(tmp & SDHCI_CDNS_HRS06_TUNE_UP),
0, 1);
- return ret;
}
- return 0;
+ return ret;
}
static int sdhci_cdns_execute_tuning(struct mmc_host *mmc, u32 opcode)
--
2.7.4
next reply other threads:[~2018-04-19 14:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-19 13:53 Gustavo A. R. Silva [this message]
2018-04-19 15:42 ` [PATCH] mmc: sdhci-cadence: fix logically and structurally dead code Masahiro Yamada
2018-04-19 15:47 ` Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180419135316.GA14790@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=adrian.hunter@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox