drivers: video: fbcmap: add signed type cast for comparation
PATCH 1/1 drivers: video: fbcmap: add signed type cast for comparation
According to fb_set_cmap() in this file, knows about it is necessary to check 'start' whether less than zero or not, so need add related type cast for its comparing.
The related warning:
drivers/video/fbcmap.c:288:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
--- drivers/video/fbcmap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/fbcmap.c +1 -1
@@ -285,7 +285,7 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) rc = -ENODEV ; goto out; } -if (cmap->start <0 || (!info->fbops->fb_setcolreg && +if ((int )cmap->start <0 || (!info->fbops->fb_setcolreg && !info->fbops->fb_setcmap)) { rc = -EINVAL ; goto out1;
Signature · 1 line
1.7.7.6
Hi
Quoted 19 lines · Chen Gang
According to
fb_set_cmap()in this file, knows about it is necessary to check 'start' whether less than zero or not, so need add related type cast for its comparing.The related warning:
drivers/video/fbcmap.c:288:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]Signed-off-by Chen Gang <[email protected]>--- drivers/video/fbcmap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/video/fbcmap.c +0
-0
drivers/video/fbcmap.c int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) · line 289
Quoted 6 lines
drivers/video/fbcmap.c +1
-1@@ -285,7 +285,7 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) rc = -ENODEV ; goto out; } -if (cmap->start <0 || (!info->fbops->fb_setcolreg && +if ((int )cmap->start <0 || (!info->fbops->fb_setcolreg && !info->fbops->fb_setcmap)) {
What's the reason to do this, anyway? fb_set_cmap() does the same but actually casts to a signed integer. So I think we can remove this check here.
Regards
David
Quoted 8 lines
drivers/video/fbcmap.c +0
-1rc = -EINVAL ; goto out1; --1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 17 lines · David Herrmann
Hi
Quoted 14 lines · Chen Gang
According to
fb_set_cmap()in this file, knows about it is necessary to check 'start' whether less than zero or not, so need add related type cast for its comparing.The related warning:
drivers/video/fbcmap.c:288:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]Signed-off-by Chen Gang <[email protected]>--- drivers/video/fbcmap.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 16 lines
drivers/video/fbcmap.c int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) · line 289
Quoted 11 lines
drivers/video/fbcmap.c +1
-1@@ -285,7 +285,7 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info) rc = -ENODEV ; goto out; } -if (cmap->start <0 || (!info->fbops->fb_setcolreg && +if ((int )cmap->start <0 || (!info->fbops->fb_setcolreg && !info->fbops->fb_setcmap)) {What's the reason to do this, anyway?
fb_set_cmap()does the same but actually casts to a signed integer. So I think we can remove this check here.
OK, that sounds reasonable to me, and now my mail client is OK, I will send patch v2 for it.
:-)
Quoted 13 lines
Regards
DavidQuoted 8 lines
drivers/video/fbcmap.c +0
-1rc = -EINVAL ; goto out1; --1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Chen Gang