* [PATCH][next] media: rcar_jpu: remove redundant case statement when c is zero
@ 2025-05-08 10:08 Colin Ian King
2025-05-08 10:27 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2025-05-08 10:08 UTC (permalink / raw)
To: Mikhail Ulyanov, Mauro Carvalho Chehab, Geert Uytterhoeven,
Magnus Damm, linux-media, linux-renesas-soc
Cc: kernel-janitors, linux-kernel
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(-)
diff --git a/drivers/media/platform/renesas/rcar_jpu.c b/drivers/media/platform/renesas/rcar_jpu.c
index 81038df71bb5..6af154b41eb4 100644
--- a/drivers/media/platform/renesas/rcar_jpu.c
+++ b/drivers/media/platform/renesas/rcar_jpu.c
@@ -643,8 +643,6 @@ static u8 jpu_parse_hdr(void *buffer, unsigned long size, unsigned int *width,
return 0;
skip(&jpeg_buffer, (long)word - 2);
break;
- case 0:
- break;
default:
return 0;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] media: rcar_jpu: remove redundant case statement when c is zero
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
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2025-05-08 10:27 UTC (permalink / raw)
To: Colin Ian King
Cc: Mikhail Ulyanov, Mauro Carvalho Chehab, Geert Uytterhoeven,
Magnus Damm, linux-media, linux-renesas-soc, kernel-janitors,
linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-08 10:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox