All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fbdev: correct tests on unsigned
@ 2009-01-18 20:07 Roel Kluin
  0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-01-18 20:07 UTC (permalink / raw)
  To: adaplas; +Cc: linux-fbdev-devel

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-18 20:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-18 20:07 [PATCH] fbdev: correct tests on unsigned Roel Kluin

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.