aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-07-24 04:19:13 -0400
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-07-29 08:25:06 -0400
commit3f6a5580464bf000649f981970192c6c7fe739de (patch)
treecf417f11e52aadf99a5a17afa4892f8cdda2a78d /drivers/video
parentf7c848b6ef31af09925bb6f4c79e236ca9f94ed9 (diff)
fbdev: Make pixel_to_pat() failure mode more friendly
If we accidentally pass an incorrect bpp value to pixel_to_pat(), it panics. This is pretty useless, as we generally have the various console locks held at that point, so nothing will be displayed, and there is no reason to make this a fatal event. Let's WARN instead. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fb_draw.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/video/fb_draw.h b/drivers/video/fb_draw.h
index 04c01faaf77..624ee115f12 100644
--- a/drivers/video/fb_draw.h
+++ b/drivers/video/fb_draw.h
@@ -3,6 +3,7 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5#include <linux/fb.h> 5#include <linux/fb.h>
6#include <linux/bug.h>
6 7
7 /* 8 /*
8 * Compose two values, using a bitmask as decision value 9 * Compose two values, using a bitmask as decision value
@@ -41,7 +42,8 @@ pixel_to_pat( u32 bpp, u32 pixel)
41 case 32: 42 case 32:
42 return 0x0000000100000001ul*pixel; 43 return 0x0000000100000001ul*pixel;
43 default: 44 default:
44 panic("pixel_to_pat(): unsupported pixelformat\n"); 45 WARN(1, "pixel_to_pat(): unsupported pixelformat %d\n", bpp);
46 return 0;
45 } 47 }
46} 48}
47#else 49#else
@@ -66,7 +68,8 @@ pixel_to_pat( u32 bpp, u32 pixel)
66 case 32: 68 case 32:
67 return 0x00000001ul*pixel; 69 return 0x00000001ul*pixel;
68 default: 70 default:
69 panic("pixel_to_pat(): unsupported pixelformat\n"); 71 WARN(1, "pixel_to_pat(): unsupported pixelformat %d\n", bpp);
72 return 0;
70 } 73 }
71} 74}
72#endif 75#endif