* [PATCH] mmc: iproc_sdhci: Cannot test unsigned variable for negative
@ 2025-07-30 16:52 Andrew Goodbody
2025-07-31 8:04 ` Peng Fan
2025-09-01 7:44 ` Peng Fan (OSS)
0 siblings, 2 replies; 3+ messages in thread
From: Andrew Goodbody @ 2025-07-30 16:52 UTC (permalink / raw)
To: Peng Fan, Jaehoon Chung, Tom Rini; +Cc: u-boot, Andrew Goodbody
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>
---
drivers/mmc/iproc_sdhci.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/iproc_sdhci.c b/drivers/mmc/iproc_sdhci.c
index 7ab74ff117a..654672a546f 100644
--- a/drivers/mmc/iproc_sdhci.c
+++ b/drivers/mmc/iproc_sdhci.c
@@ -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);
---
base-commit: a8f20bb6650df56d2600cda2c66f9349df9e49c8
change-id: 20250730-iproc_sdhci-f0a5d4084c85
Best regards,
--
Andrew Goodbody <andrew.goodbody@linaro.org>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: iproc_sdhci: Cannot test unsigned variable for negative
2025-07-30 16:52 [PATCH] mmc: iproc_sdhci: Cannot test unsigned variable for negative Andrew Goodbody
@ 2025-07-31 8:04 ` Peng Fan
2025-09-01 7:44 ` Peng Fan (OSS)
1 sibling, 0 replies; 3+ messages in thread
From: Peng Fan @ 2025-07-31 8:04 UTC (permalink / raw)
To: Andrew Goodbody; +Cc: Peng Fan, Jaehoon Chung, Tom Rini, u-boot
On Wed, Jul 30, 2025 at 05:52:56PM +0100, Andrew Goodbody wrote:
>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.
>
Per my understanding GCC default takes char as signed. But after
doing some study, char could be signed or unsigned. So it
make sense to use s8 to avoid potential issue.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Thanks,
Peng
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: iproc_sdhci: Cannot test unsigned variable for negative
2025-07-30 16:52 [PATCH] mmc: iproc_sdhci: Cannot test unsigned variable for negative Andrew Goodbody
2025-07-31 8:04 ` Peng Fan
@ 2025-09-01 7:44 ` Peng Fan (OSS)
1 sibling, 0 replies; 3+ messages in thread
From: Peng Fan (OSS) @ 2025-09-01 7:44 UTC (permalink / raw)
To: u-boot, Jaehoon Chung, Tom Rini, Andrew Goodbody; +Cc: Peng Fan
From: Peng Fan <peng.fan@nxp.com>
On Wed, 30 Jul 2025 17:52:56 +0100, Andrew Goodbody wrote:
> 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.
>
>
> [...]
Applied, thanks!
[1/1] mmc: iproc_sdhci: Cannot test unsigned variable for negative
commit: 95994d4e5996610c8205597b2849b48eaaf2baff
Best regards,
--
Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-01 6:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-30 16:52 [PATCH] mmc: iproc_sdhci: Cannot test unsigned variable for negative Andrew Goodbody
2025-07-31 8:04 ` Peng Fan
2025-09-01 7:44 ` Peng Fan (OSS)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).