linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roel Kluin <roel.kluin@gmail.com>
To: adaplas@gmail.com
Cc: linux-fbdev-devel@lists.sourceforge.net
Subject: [PATCH] fbdev: correct tests on unsigned
Date: Sun, 18 Jan 2009 21:07:13 +0100	[thread overview]
Message-ID: <49738BF1.2030908@gmail.com> (raw)

image->dx, ->dy and con2fb.framebuffer are unsigned, so the tests for
negatives are wrong or redundant. correct them.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 756efeb..4f576bb 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -393,8 +393,10 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
 			image->dx += image->width + 8;
 		}
 	} else if (rotate == FB_ROTATE_UD) {
-		for (x = 0; x < num && image->dx >= 0; x++) {
+		for (x = 0; x < num; x++) {
 			info->fbops->fb_imageblit(info, image);
+			if (image->dx < image->width + 8)
+				break;
 			image->dx -= image->width + 8;
 		}
 	} else if (rotate == FB_ROTATE_CW) {
@@ -405,8 +407,10 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
 			image->dy += image->height + 8;
 		}
 	} else if (rotate == FB_ROTATE_CCW) {
-		for (x = 0; x < num && image->dy >= 0; x++) {
+		for (x = 0; x < num; x++) {
 			info->fbops->fb_imageblit(info, image);
+			if (image->dx < image->width + 8)
+				break;
 			image->dy -= image->height + 8;
 		}
 	}
@@ -1094,7 +1098,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
 			ret = -EINVAL;
 			break;
 		}
-		if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX) {
+		if (con2fb.framebuffer >= FB_MAX) {
 			ret = -EINVAL;
 			break;
 		}

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword

                 reply	other threads:[~2009-01-18 20:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=49738BF1.2030908@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=adaplas@gmail.com \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /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 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).