All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Gardner <tim.gardner@canonical.com>
To: Maxin B John <maxin.john@gmail.com>
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	airlied@redhat.com, lethal@linux-sh.org, james@albanarts.com,
	error27@gmail.com, randy.dunlap@oracle.com
Subject: Re: [PATCH] drivers: video: Remove useless checks
Date: Wed, 25 May 2011 06:47:43 -0600	[thread overview]
Message-ID: <4DDCFA6F.2020801@canonical.com> (raw)
In-Reply-To: <20110519182702.GA3337@maxin>

On 05/19/2011 12:27 PM, Maxin B John wrote:
> Comparing unsigned less than zero will never be true.
> Removing similar checks from 'fbmem.c' and 'fbcmap.c'.
>
> Please let me know your comments.
>
> Signed-off-by: Maxin B. John<maxin.john@gmail.com>
> ---
> diff --git a/drivers/video/fbcmap.c b/drivers/video/fbcmap.c
> index 5c3960d..15cf8fc 100644
> --- a/drivers/video/fbcmap.c
> +++ b/drivers/video/fbcmap.c
> @@ -285,8 +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&&
> -				!info->fbops->fb_setcmap)) {
> +	if (!info->fbops->fb_setcolreg&&  !info->fbops->fb_setcmap) {
>   		rc = -EINVAL;
>   		goto out1;
>   	}
> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
> index 5aac00e..9edca4d 100644
> --- a/drivers/video/fbmem.c
> +++ b/drivers/video/fbmem.c
> @@ -1143,7 +1143,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
>   			return -EFAULT;
>   		if (con2fb.console<  1 || con2fb.console>  MAX_NR_CONSOLES)
>   			return -EINVAL;
> -		if (con2fb.framebuffer<  0 || con2fb.framebuffer>= FB_MAX)
> +		if (con2fb.framebuffer>= FB_MAX)
>   			return -EINVAL;
>   		if (!registered_fb[con2fb.framebuffer])
>   			request_module("fb%d", con2fb.framebuffer);
>

Looks right to me, though there are other places that suffer from the 
same issue. See fb_set_cmap() and its use of 'int start' and cmap->start.

rtg
-- 
Tim Gardner tim.gardner@canonical.com

  parent reply	other threads:[~2011-05-25 12:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-19 18:27 [PATCH] drivers: video: Remove useless checks Maxin B John
2011-05-22  8:06 ` Maxin B John
2011-05-25 12:47 ` Tim Gardner [this message]
2011-05-26  9:30   ` Maxin B John
2011-05-26 13:43     ` Tim Gardner
2011-05-26 15:31       ` Maxin B John
2011-06-03  9:29 ` Maxin B John
2011-06-03 20:11   ` Joe Perches

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=4DDCFA6F.2020801@canonical.com \
    --to=tim.gardner@canonical.com \
    --cc=airlied@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=error27@gmail.com \
    --cc=james@albanarts.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxin.john@gmail.com \
    --cc=randy.dunlap@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.