linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: video: fbcmap: add signed type cast for comparation
@ 2013-07-22  8:26 Chen Gang
  2013-08-16 13:56 ` David Herrmann
  2013-08-20  2:24 ` Chen Gang
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Gang @ 2013-07-22  8:26 UTC (permalink / raw)
  To: linux-fbdev

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 <gang.chen@asianux.com>
---
 drivers/video/fbcmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c
index 5c3960d..44c88e3 100644
--- a/drivers/video/fbcmap.c
+++ b/drivers/video/fbcmap.c
@@ -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;
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers: video: fbcmap: add signed type cast for comparation
  2013-07-22  8:26 [PATCH] drivers: video: fbcmap: add signed type cast for comparation Chen Gang
@ 2013-08-16 13:56 ` David Herrmann
  2013-08-20  2:24 ` Chen Gang
  1 sibling, 0 replies; 3+ messages in thread
From: David Herrmann @ 2013-08-16 13:56 UTC (permalink / raw)
  To: linux-fbdev

Hi

On Mon, Jul 22, 2013 at 10:26 AM, Chen Gang <gang.chen@asianux.com> wrote:
> 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 <gang.chen@asianux.com>
> ---
>  drivers/video/fbcmap.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c
> index 5c3960d..44c88e3 100644
> --- a/drivers/video/fbcmap.c
> +++ b/drivers/video/fbcmap.c
> @@ -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

>                 rc = -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drivers: video: fbcmap: add signed type cast for comparation
  2013-07-22  8:26 [PATCH] drivers: video: fbcmap: add signed type cast for comparation Chen Gang
  2013-08-16 13:56 ` David Herrmann
@ 2013-08-20  2:24 ` Chen Gang
  1 sibling, 0 replies; 3+ messages in thread
From: Chen Gang @ 2013-08-20  2:24 UTC (permalink / raw)
  To: linux-fbdev

On 08/16/2013 09:56 PM, David Herrmann wrote:
> Hi
> 
> On Mon, Jul 22, 2013 at 10:26 AM, Chen Gang <gang.chen@asianux.com> wrote:
>> 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 <gang.chen@asianux.com>
>> ---
>>  drivers/video/fbcmap.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c
>> index 5c3960d..44c88e3 100644
>> --- a/drivers/video/fbcmap.c
>> +++ b/drivers/video/fbcmap.c
>> @@ -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.

:-)

> Regards
> David
> 
>>                 rc = -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 majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 


-- 
Chen Gang

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-20  2:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-22  8:26 [PATCH] drivers: video: fbcmap: add signed type cast for comparation Chen Gang
2013-08-16 13:56 ` David Herrmann
2013-08-20  2:24 ` Chen Gang

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).