* [PATCH] media: rc: rc-ir-raw: drop useless decrements in ir_raw_gen_{manchester,pl}()
@ 2026-08-18 20:38 Sergey Shtylyov
2026-08-18 20:54 ` Sergey Shtylyov
0 siblings, 1 reply; 2+ messages in thread
From: Sergey Shtylyov @ 2026-08-18 20:38 UTC (permalink / raw)
To: Sean Young, Mauro Carvalho Chehab, linux-media; +Cc: Sergey Shtylyov
In ir_raw_gen_{manchester,pl}(), the paremeter max is usually decremented
while checking it for 0 but sometimes that action seems fruitless as max
isn't used afterwards -- drop the useless decrement operators...
Found by Linux Verification Center (linuxtesting.org) with the Svace static
analysis tool.
Signed-off-by: Sergey Shtylyov <s.shtylyov@auroraos.dev>
---
The patch is against the next branch of the linuxtv.org/media.git repo...
drivers/media/rc/rc-ir-raw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index ba24c2f22d39..ed494be8896f 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -362,7 +362,7 @@ int ir_raw_gen_manchester(struct ir_raw_event **ev, unsigned int max,
if (timings->trailer_space) {
if (!(*ev)->pulse)
(*ev)->duration += timings->trailer_space;
- else if (!max--)
+ else if (!max)
goto nobufs;
else
init_ir_raw_event_duration(++(*ev), 0,
@@ -491,7 +491,7 @@ int ir_raw_gen_pl(struct ir_raw_event **ev, unsigned int max,
}
}
- if (!max--)
+ if (!max)
return ret;
init_ir_raw_event_duration((*ev)++, 0, timings->trailer_space);
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: rc: rc-ir-raw: drop useless decrements in ir_raw_gen_{manchester,pl}()
2026-08-18 20:38 [PATCH] media: rc: rc-ir-raw: drop useless decrements in ir_raw_gen_{manchester,pl}() Sergey Shtylyov
@ 2026-08-18 20:54 ` Sergey Shtylyov
0 siblings, 0 replies; 2+ messages in thread
From: Sergey Shtylyov @ 2026-08-18 20:54 UTC (permalink / raw)
To: Sean Young, Mauro Carvalho Chehab, linux-media
On 8/18/26 11:38 PM, Sergey Shtylyov wrote:
> In ir_raw_gen_{manchester,pl}(), the paremeter max is usually decremented
Oops, s/paremeter/parameter/... :-)
> while checking it for 0 but sometimes that action seems fruitless as max
> isn't used afterwards -- drop the useless decrement operators...
>
> Found by Linux Verification Center (linuxtesting.org) with the Svace static
> analysis tool.
>
> Signed-off-by: Sergey Shtylyov <s.shtylyov@auroraos.dev>[...]
MBR, Sergey
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-18 20:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 20:38 [PATCH] media: rc: rc-ir-raw: drop useless decrements in ir_raw_gen_{manchester,pl}() Sergey Shtylyov
2026-08-18 20:54 ` Sergey Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox