* [PATCH] OMAP: DSS2: remove non-zero check on variable r
@ 2019-12-04 15:28 ` Colin King
2020-01-15 15:42 ` Bartlomiej Zolnierkiewicz
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2019-12-04 15:28 UTC (permalink / raw)
To: Bartlomiej Zolnierkiewicz, Tomi Valkeinen, linux-omap,
linux-fbdev, dri-devel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Variable r is being initialized to zero, so the check of a non-zero
rv is redundant and can be removed.
It appears that the previous case statements set r to be -EINVAL
and the "Fallthrough" comment afterwards suggested it was going
to fall through to this non-zero check but won't because of the
break statement. Remove the confusion by removing the Fallthrough
comment too.
Addresses-Coverity: ("Logically dead code")
Fixes: b39a982ddecf ("OMAP: DSS2: omapfb driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/video/fbdev/omap2/omapfb/omapfb-main.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c
index 858c2c011d19..a2a2c1b205d9 100644
--- a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c
@@ -1154,16 +1154,12 @@ static int _setcolreg(struct fb_info *fbi, u_int regno, u_int red, u_int green,
r = fbdev->ctrl->setcolreg(regno, red, green, blue,
transp, update_hw_pal);
*/
- /* Fallthrough */
r = -EINVAL;
break;
case OMAPFB_COLOR_RGB565:
case OMAPFB_COLOR_RGB444:
case OMAPFB_COLOR_RGB24P:
case OMAPFB_COLOR_RGB24U:
- if (r != 0)
- break;
-
if (regno < 16) {
u32 pal;
pal = ((red >> (16 - var->red.length)) <<
--
2.24.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] OMAP: DSS2: remove non-zero check on variable r
2019-12-04 15:28 ` [PATCH] OMAP: DSS2: remove non-zero check on variable r Colin King
@ 2020-01-15 15:42 ` Bartlomiej Zolnierkiewicz
0 siblings, 0 replies; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2020-01-15 15:42 UTC (permalink / raw)
To: Colin King
Cc: linux-fbdev, kernel-janitors, linux-kernel, dri-devel,
Tomi Valkeinen, linux-omap
On 12/4/19 4:28 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Variable r is being initialized to zero, so the check of a non-zero
> rv is redundant and can be removed.
>
> It appears that the previous case statements set r to be -EINVAL
> and the "Fallthrough" comment afterwards suggested it was going
> to fall through to this non-zero check but won't because of the
> break statement. Remove the confusion by removing the Fallthrough
> comment too.
>
> Addresses-Coverity: ("Logically dead code")
> Fixes: b39a982ddecf ("OMAP: DSS2: omapfb driver")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Patch queued for v5.6, thanks.
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
> ---
> drivers/video/fbdev/omap2/omapfb/omapfb-main.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c
> index 858c2c011d19..a2a2c1b205d9 100644
> --- a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c
> +++ b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c
> @@ -1154,16 +1154,12 @@ static int _setcolreg(struct fb_info *fbi, u_int regno, u_int red, u_int green,
> r = fbdev->ctrl->setcolreg(regno, red, green, blue,
> transp, update_hw_pal);
> */
> - /* Fallthrough */
> r = -EINVAL;
> break;
> case OMAPFB_COLOR_RGB565:
> case OMAPFB_COLOR_RGB444:
> case OMAPFB_COLOR_RGB24P:
> case OMAPFB_COLOR_RGB24U:
> - if (r != 0)
> - break;
> -
> if (regno < 16) {
> u32 pal;
> pal = ((red >> (16 - var->red.length)) <<
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-15 15:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20191204152851epcas5p413006712eafa500de3013c2ce8a3bc02@epcas5p4.samsung.com>
2019-12-04 15:28 ` [PATCH] OMAP: DSS2: remove non-zero check on variable r Colin King
2020-01-15 15:42 ` Bartlomiej Zolnierkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).