Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Benjamin Herrenschmidt and committed by
Florian Tobias Schandinat
3f6a5580 f7c848b6

+5 -2
+5 -2
drivers/video/fb_draw.h
··· 3 3 4 4 #include <asm/types.h> 5 5 #include <linux/fb.h> 6 + #include <linux/bug.h> 6 7 7 8 /* 8 9 * Compose two values, using a bitmask as decision value ··· 42 41 case 32: 43 42 return 0x0000000100000001ul*pixel; 44 43 default: 45 - panic("pixel_to_pat(): unsupported pixelformat\n"); 44 + WARN(1, "pixel_to_pat(): unsupported pixelformat %d\n", bpp); 45 + return 0; 46 46 } 47 47 } 48 48 #else ··· 68 66 case 32: 69 67 return 0x00000001ul*pixel; 70 68 default: 71 - panic("pixel_to_pat(): unsupported pixelformat\n"); 69 + WARN(1, "pixel_to_pat(): unsupported pixelformat %d\n", bpp); 70 + return 0; 72 71 } 73 72 } 74 73 #endif