Skip to contentSkip to conversation

mmc: loongson2: Fix comparison of unsigned integer with less than zero

PATCH In review Colin Ian King 2 participants 2 messages Jul 8, 2025 – Jul 9, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: loongson2: Fix comparison of unsigned integer with less than zero

From: Colin Ian King <[email protected]>

Currently the u32 variable ret is being assigned the return value from the call to regmap_read_poll_timeout and checking for a less than zero error return and this check is always false. Fix this by making ret a signed integer.

Fixes d0f8e961deae ("mmc: loongson2: Add Loongson-2K2000 SD/SDIO/eMMC controller driver")
---
 drivers/mmc/host/loongson2-mmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/loongson2-mmc.c +2 -1
index 515ccf834f0a..ba6bb8fd5535 100644
@@ -485,7 +485,8 @@ static irqreturn_t loongson2_mmc_irq(int irq, void *devid)
 
 static void loongson2_mmc_dll_mode_init(struct loongson2_mmc_host *host)
 {
-	u32 val, pad_delay, delay, ret;
+	u32 val, pad_delay, delay;
+	int ret;
 
 	regmap_update_bits(host->regmap, LOONGSON2_MMC_REG_SEL,
 			   LOONGSON2_MMC_SEL_DATA, LOONGSON2_MMC_SEL_DATA);
Signature · 1 line
2.50.0
maintainer
#1 lore raw

Hi Colin:

Thanks for your patch.

Sergio has already submitted the relevant patch to fix this issue:

https://lore.kernel.org/all/[email protected]/

Thank you for your attention to loongson2 mmc driver.

Quoted 18 lines · Colin Ian King

From: Colin Ian King <[email protected]>

Currently the u32 variable ret is being assigned the return value from the call to regmap_read_poll_timeout and checking for a less than zero error return and this check is always false. Fix this by making ret a signed integer.

Fixes d0f8e961deae ("mmc: loongson2: Add Loongson-2K2000 SD/SDIO/eMMC controller driver")
---
  drivers/mmc/host/loongson2-mmc.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/loongson2-mmc.c +0 -0
index 515ccf834f0a..ba6bb8fd5535 100644

drivers/mmc/host/loongson2-mmc.c static irqreturn_t loongson2_mmc_irq(int irq, void *devid) · line 492

Quoted 9 lines
drivers/mmc/host/loongson2-mmc.c +2 -1
@@ -485,7 +485,8 @@ static irqreturn_t loongson2_mmc_irq(int irq, void *devid)
 
  static void loongson2_mmc_dll_mode_init(struct loongson2_mmc_host *host)
  {
-	u32 val, pad_delay, delay, ret;
+	u32 val, pad_delay, delay;
+	int ret;
 
  	regmap_update_bits(host->regmap, LOONGSON2_MMC_REG_SEL,
  			   LOONGSON2_MMC_SEL_DATA, LOONGSON2_MMC_SEL_DATA);

Thanks.
Binbin