U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: spacemit: fix the greater-than-or-equal-to-zero comparison
@ 2026-11-05  1:27 Eric Chung
  2026-11-05  1:44 ` E Shattow
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Chung @ 2026-11-05  1:27 UTC (permalink / raw)
  To: Tanmay Kathpalia, u-boot-spacemit, u-boot
  Cc: Huan Zhou, Yixun Lan, Peng Fan, Jaehoon Chung, Tom Rini,
	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.

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>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mmc: spacemit: fix the greater-than-or-equal-to-zero comparison
  2026-11-05  1:27 [PATCH] mmc: spacemit: fix the greater-than-or-equal-to-zero comparison Eric Chung
@ 2026-11-05  1:44 ` E Shattow
  0 siblings, 0 replies; 2+ messages in thread
From: E Shattow @ 2026-11-05  1:44 UTC (permalink / raw)
  To: Eric Chung, Tanmay Kathpalia, u-boot-spacemit, u-boot
  Cc: Huan Zhou, Yixun Lan, Peng Fan, Jaehoon Chung, Tom Rini

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-05  1:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-05  1:27 [PATCH] mmc: spacemit: fix the greater-than-or-equal-to-zero comparison Eric Chung
2026-11-05  1:44 ` E Shattow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox