From: Sean Young <sean@mess.org>
To: Sergey Shtylyov <s.shtylyov@auroraos.dev>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>, linux-media@vger.kernel.org
Subject: Re: [PATCH] media: rc: rc-ir-raw: drop useless decrements in ir_raw_gen_{manchester,pl}()
Date: Wed, 19 Aug 2026 08:31:26 +0100 [thread overview]
Message-ID: <aoVbzp0cn1euNa_h@extorris.mess.org> (raw)
In-Reply-To: <20260818203832.46030-1-s.shtylyov@auroraos.dev>
On Tue, Aug 18, 2026 at 11:38:30PM +0300, Sergey Shtylyov wrote:
> 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)
This patch is technically correct, but won't make any difference to
generated code. The decremented value of max will have zero users in the
SSA tree, and will be droppped.
Changing this is purely cosmetic change to the code.
Sean
> return ret;
>
> init_ir_raw_event_duration((*ev)++, 0, timings->trailer_space);
> --
> 2.55.0
>
next prev parent reply other threads:[~2026-08-19 7:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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
2026-08-19 7:31 ` Sean Young [this message]
2026-08-19 15:17 ` Sergey Shtylyov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aoVbzp0cn1euNa_h@extorris.mess.org \
--to=sean@mess.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=s.shtylyov@auroraos.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox