Skip to contentSkip to conversation

mmc: spacemit: fix the greater-than-or-equal-to-zero comparison

PATCH In review Eric Chung 2 participants 2 messages Nov 5

Subsystems (2)
lore
Share & tools
lore

Eric Chung

author
#0 lore raw

PATCH 1/1 mmc: spacemit: fix the greater-than-or-equal-to-zero comparison

CID 661178: Control flow issues (NO_EFFECT)
This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "retry_delays[i] >= 0".

Since SPACEMIT_RX_TUNE_DELAY_MIN is declared as zero, it causes Coverity reporting the comparison issue.

Now remove the redundant comparison.

---
 drivers/mmc/spacemit_sdhci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/spacemit_sdhci.c +1 -2
index f5578f38bdd1..3e0e7901b59d 100644
@@ -473,8 +473,7 @@ static int spacemit_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
 			    final_delay);
 
 		for (i = 0; i < retry_count; i++) {
-			if (retry_delays[i] >= SPACEMIT_RX_TUNE_DELAY_MIN &&
-			    retry_delays[i] <= SPACEMIT_RX_TUNE_DELAY_MAX) {
+			if (retry_delays[i] <= SPACEMIT_RX_TUNE_DELAY_MAX) {
 				spacemit_sdhci_set_rx_delay(host, retry_delays[i]);
 				ret = mmc_send_tuning(host->mmc, opcode);
 				if (!ret) {

---
base-commit: d1d45c926a571fb6c1e6d7105c280833646915ea
change-id: 20261105-fix_cid-fe26c76c2c51

Best regards,

Signature · 1 line
Eric Chung <[email protected]>
#1 lore raw
Quoted 33 lines · Eric Chung

CID 661178: Control flow issues (NO_EFFECT)
This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "retry_delays[i] >= 0".

Since SPACEMIT_RX_TUNE_DELAY_MIN is declared as zero, it causes Coverity reporting the comparison issue.

Now remove the redundant comparison.

---
 drivers/mmc/spacemit_sdhci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/spacemit_sdhci.c +1 -3
index f5578f38bdd1..3e0e7901b59d 100644
@@ -473,8 +473,7 @@ static int spacemit_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
 			    final_delay);
 
 		for (i = 0; i < retry_count; i++) {
-			if (retry_delays[i] >= SPACEMIT_RX_TUNE_DELAY_MIN &&
-			    retry_delays[i] <= SPACEMIT_RX_TUNE_DELAY_MAX) {
+			if (retry_delays[i] <= SPACEMIT_RX_TUNE_DELAY_MAX) {
 				spacemit_sdhci_set_rx_delay(host, retry_delays[i]);
 				ret = mmc_send_tuning(host->mmc, opcode);
 				if (!ret) {
 
---

base-commit: d1d45c926a571fb6c1e6d7105c280833646915ea
change-id: 20261105-fix_cid-fe26c76c2c51

Quoted 4 lines

Best regards,

Signature · 1 line
Eric Chung <[email protected]>

This change does not make sense. We may adjust the preprocessor define at build time in the future.

-E