| Message ID | 20261105-fix_cid-v1-1-e44bc1da8900@riscstar.com |
|---|---|
| State | New |
| Delegated to: | Tim Ouyang |
| Headers | show |
| Series | mmc: spacemit: fix the greater-than-or-equal-to-zero comparison | expand |
On 11/4/26 17:27, Eric Chung wrote: > 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. > > Signed-off-by: Eric Chung <eric.chung@riscstar.com> > --- > drivers/mmc/spacemit_sdhci.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/mmc/spacemit_sdhci.c b/drivers/mmc/spacemit_sdhci.c > index f5578f38bdd1..3e0e7901b59d 100644 > --- a/drivers/mmc/spacemit_sdhci.c > +++ b/drivers/mmc/spacemit_sdhci.c > @@ -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, > -- > Eric Chung <eric.chung@riscstar.com> > This change does not make sense. We may adjust the preprocessor define at build time in the future. -E
diff --git a/drivers/mmc/spacemit_sdhci.c b/drivers/mmc/spacemit_sdhci.c index f5578f38bdd1..3e0e7901b59d 100644 --- a/drivers/mmc/spacemit_sdhci.c +++ b/drivers/mmc/spacemit_sdhci.c @@ -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) {
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. Signed-off-by: Eric Chung <eric.chung@riscstar.com> --- drivers/mmc/spacemit_sdhci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- base-commit: d1d45c926a571fb6c1e6d7105c280833646915ea change-id: 20261105-fix_cid-fe26c76c2c51 Best regards, -- Eric Chung <eric.chung@riscstar.com>