* [PATCH] staging: sm750fb: remove unused variable 'tmp' in sw_i2c_wait
@ 2026-09-23 1:35 Eduard Zateev
2026-09-23 7:34 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Eduard Zateev @ 2026-09-23 1:35 UTC (permalink / raw)
To: Greg Kroah-Hartman, Sudip Mukherjee, Teddy Wang
Cc: linux-staging, linux-fbdev, linux-kernel, Eduard Zateev
The variable 'tmp' in sw_i2c_wait() is written but never read outside
the loop, triggering a set-but-not-used warning with W=1. The loop
itself is a fixed-count busy-wait with no side effects; remove the
unused variable and keep the empty loop body.
Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>
---
drivers/staging/sm750fb/ddk750_swi2c.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/sm750fb/ddk750_swi2c.c b/drivers/staging/sm750fb/ddk750_swi2c.c
index e63f3b00ec4c..55623ad35be2 100644
--- a/drivers/staging/sm750fb/ddk750_swi2c.c
+++ b/drivers/staging/sm750fb/ddk750_swi2c.c
@@ -92,12 +92,10 @@ static void sw_i2c_wait(void)
* it's more reliable than counter loop ..
* write 0x61 to 0x3ce and read from 0x3cf
*/
- int i, tmp;
+ int i;
- for (i = 0; i < 600; i++) {
- tmp = i;
- tmp += i;
- }
+ for (i = 0; i < 600; i++)
+ ;
}
/*
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: sm750fb: remove unused variable 'tmp' in sw_i2c_wait
2026-09-23 1:35 [PATCH] staging: sm750fb: remove unused variable 'tmp' in sw_i2c_wait Eduard Zateev
@ 2026-09-23 7:34 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2026-09-23 7:34 UTC (permalink / raw)
To: Eduard Zateev
Cc: Greg Kroah-Hartman, Sudip Mukherjee, Teddy Wang, linux-staging,
linux-fbdev, linux-kernel
On Wed, Sep 23, 2026 at 03:35:26AM +0200, Eduard Zateev wrote:
> The variable 'tmp' in sw_i2c_wait() is written but never read outside
> the loop, triggering a set-but-not-used warning with W=1. The loop
> itself is a fixed-count busy-wait with no side effects; remove the
> unused variable and keep the empty loop body.
>
> Signed-off-by: Eduard Zateev <hackerowskiy@gmail.com>
> ---
Search the archives to see if someone has sent a patch like this
before.
https://lore.kernel.org/all/abfFn_AET_xAVjji@stanley.mountain/
Compilers often remove empty busy loops so that probably explains
why they added the nonsense code.
We don't want to silence this warning because the code is legitimately
bad and should trigger a warning. But until someone can test it, then
it's impossible to fix.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-23 7:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 1:35 [PATCH] staging: sm750fb: remove unused variable 'tmp' in sw_i2c_wait Eduard Zateev
2026-09-23 7:34 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®