Skip to content

Commit

Permalink
fbdev: Make pixel_to_pat() failure mode more friendly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ozbenh authored and schandinat committed Jul 29, 2012
1 parent f7c848b commit 3f6a558
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/video/fb_draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <asm/types.h>
#include <linux/fb.h>
#include <linux/bug.h>

/*
* Compose two values, using a bitmask as decision value
Expand Down Expand Up @@ -41,7 +42,8 @@ pixel_to_pat( u32 bpp, u32 pixel)
case 32:
return 0x0000000100000001ul*pixel;
default:
panic("pixel_to_pat(): unsupported pixelformat\n");
WARN(1, "pixel_to_pat(): unsupported pixelformat %d\n", bpp);
return 0;
}
}
#else
Expand All @@ -66,7 +68,8 @@ pixel_to_pat( u32 bpp, u32 pixel)
case 32:
return 0x00000001ul*pixel;
default:
panic("pixel_to_pat(): unsupported pixelformat\n");
WARN(1, "pixel_to_pat(): unsupported pixelformat %d\n", bpp);
return 0;
}
}
#endif
Expand Down

0 comments on commit 3f6a558

Please sign in to comment.