]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mmc: iproc_sdhci: Cannot test unsigned variable for negative
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Wed, 30 Jul 2025 16:52:56 +0000 (17:52 +0100)
committerPeng Fan <peng.fan@nxp.com>
Mon, 1 Sep 2025 02:33:09 +0000 (10:33 +0800)
In sdhci_iproc_execute_tuning the variable tuning_loop_counter is
unsigned and therefore will always fail the test for it being less than
0. Fix this by changing the variable type to be s8.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/mmc/iproc_sdhci.c

index 7ab74ff117a697fe1d89b0acb7c7c66f54d6eafe..654672a546f0ca90c98321dbaf68b185038bd882 100644 (file)
@@ -182,7 +182,7 @@ static int sdhci_iproc_execute_tuning(struct mmc *mmc, u8 opcode)
        u32 ctrl;
        u32 blocksize = SDHCI_MAKE_BLKSZ(SDHCI_DEFAULT_BOUNDARY_ARG, 64);
        struct sdhci_host *host = dev_get_priv(mmc->dev);
-       char tuning_loop_counter = MAX_TUNING_LOOP;
+       s8 tuning_loop_counter = MAX_TUNING_LOOP;
        int ret = 0;
 
        sdhci_start_tuning(host);