From: Dan Carpenter <dan.carpenter@linaro.org>
To: Colin Ian King <colin.i.king@gmail.com>
Cc: Mikhail Ulyanov <mikhail.ulyanov@cogentembedded.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>,
linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] media: rcar_jpu: remove redundant case statement when c is zero
Date: Thu, 8 May 2025 13:27:25 +0300 [thread overview]
Message-ID: <aByHDZyu0pptFUlK@stanley.mountain> (raw)
In-Reply-To: <20250508100835.336240-1-colin.i.king@gmail.com>
On Thu, May 08, 2025 at 11:08:35AM +0100, Colin Ian King wrote:
> The case statement where c is zero is redundant because the previous
> while loop will only exit if c is non-zero or non-0xff, so c can
> never be zero by the time the switch statement is reaced. Clean up
> the code by removing it.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> drivers/media/platform/renesas/rcar_jpu.c | 2 --
> 1 file changed, 2 deletions(-)
>
612
613 for (;;) {
614 int c;
615
616 /* skip preceding filler bytes */
617 do
618 c = get_byte(&jpeg_buffer);
619 while (c == 0xff || c == 0);
Unrelated to your commit, but get_byte() returns -1 for out of
bounds. I wish there were a explicit check for that. We end
up hitting one of the "return 0;" statements depending on if
we've found a JPEG_MARKER_SOI.
regards,
dan carpenter
prev parent reply other threads:[~2025-05-08 10:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 10:08 [PATCH][next] media: rcar_jpu: remove redundant case statement when c is zero Colin Ian King
2025-05-08 10:27 ` Dan Carpenter [this message]
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=aByHDZyu0pptFUlK@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=colin.i.king@gmail.com \
--cc=geert+renesas@glider.be \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mchehab@kernel.org \
--cc=mikhail.ulyanov@cogentembedded.com \
/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