Skip to contentSkip to conversation

fm2fb: The pseudo_palette is only 16 elements long

PATCH In review Antonino A. Daplas 2 participants 2 messages Jun 2, 2007 – Jun 3, 2007 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 6/24 fm2fb: The pseudo_palette is only 16 elements long

The pseudo_palette is only 16 elements long.

---

 drivers/video/fm2fb.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
drivers/video/fm2fb.c +9 -7
index 70ff55b..6c91c61 100644
@@ -195,13 +195,15 @@ static int fm2fb_blank(int blank, struct
 static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
                          u_int transp, struct fb_info *info)
 {
-	if (regno > info->cmap.len)
-		return 1;
-	red >>= 8;
-	green >>= 8;
-	blue >>= 8;
+	if (regno < 16) {
+		red >>= 8;
+		green >>= 8;
+		blue >>= 8;
+
+		((u32*)(info->pseudo_palette))[regno] = (red << 16) |
+			(green << 8) | blue;
+	}
 
-	((u32*)(info->pseudo_palette))[regno] = (red << 16) | (green << 8) | blue;
 	return 0;
 }
 
@@ -237,7 +239,7 @@ static int __devinit fm2fb_probe(struct 
 	if (!zorro_request_device(z,"fm2fb"))
 		return -ENXIO;
 
-	info = framebuffer_alloc(256 * sizeof(u32), &z->dev);
+	info = framebuffer_alloc(16 * sizeof(u32), &z->dev);
 	if (!info) {
 		zorro_release_device(z);
 		return -ENOMEM;

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

Acked-by on v1 6/24
#1 lore raw
Quoted 3 lines · Antonino A. Daplas

The pseudo_palette is only 16 elements long.

Quoted 35 lines

---

 drivers/video/fm2fb.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
drivers/video/fm2fb.c +8 -6
index 70ff55b..6c91c61 100644
@@ -195,13 +195,15 @@ static int fm2fb_blank(int blank, struct
 static int fm2fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
                          u_int transp, struct fb_info *info)
 {
-	if (regno > info->cmap.len)
-		return 1;
-	red >>= 8;
-	green >>= 8;
-	blue >>= 8;
+	if (regno < 16) {
+		red >>= 8;
+		green >>= 8;
+		blue >>= 8;
+
+		((u32*)(info->pseudo_palette))[regno] = (red << 16) |
+			(green << 8) | blue;
+	}
 
-	((u32*)(info->pseudo_palette))[regno] = (red << 16) | (green << 8) | blue;
 	return 0;
 }
 

drivers/video/fm2fb.c static int __devinit fm2fb_probe(struct · line 245

Quoted 8 lines
drivers/video/fm2fb.c +1 -1
@@ -237,7 +239,7 @@ static int __devinit fm2fb_probe(struct 
 	if (!zorro_request_device(z,"fm2fb"))
 		return -ENXIO;
 
-	info = framebuffer_alloc(256 * sizeof(u32), &z->dev);
+	info = framebuffer_alloc(16 * sizeof(u32), &z->dev);
 	if (!info) {
 		zorro_release_device(z);
 		return -ENOMEM;

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/