summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorWang YanQing <udknight@gmail.com>2012-03-02 02:45:31 +0100
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-03-08 19:13:10 +0100
commitc2bc0a756b1f98bd712fabe78eb49d7d5ae72075 (patch)
treebbfbfd8be4ca41308f3ac768f969b46aec93eb3e /drivers/video
parentvideo:uvesafb: Fix oops that uvesafb try to execute NX-protected page (diff)
downloadlinux-c2bc0a756b1f98bd712fabe78eb49d7d5ae72075.tar.xz
linux-c2bc0a756b1f98bd712fabe78eb49d7d5ae72075.zip
video:uvesafb: notice user when we failed to save hardware state
uvesafb_open may failed to save hardware state when kmalloc failed in uvesafb_vbe_state_save, we should check this and notice user. Signed-off-by: Wang YanQing <udknight@gmail.com> Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to '')
-rw-r--r--drivers/video/uvesafb.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
index f9a670d338d2..1f882ed6ba04 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -363,7 +363,7 @@ static u8 *uvesafb_vbe_state_save(struct uvesafb_par *par)
state = kmalloc(par->vbe_state_size, GFP_KERNEL);
if (!state)
- return NULL;
+ return ERR_PTR(-ENOMEM);
task = uvesafb_prep();
if (!task) {
@@ -1180,9 +1180,17 @@ static int uvesafb_open(struct fb_info *info, int user)
{
struct uvesafb_par *par = info->par;
int cnt = atomic_read(&par->ref_count);
+ u8 *buf = NULL;
- if (!cnt && par->vbe_state_size)
- par->vbe_state_orig = uvesafb_vbe_state_save(par);
+ if (!cnt && par->vbe_state_size) {
+ buf = uvesafb_vbe_state_save(par);
+ if (IS_ERR(buf)) {
+ printk(KERN_WARNING "uvesafb: save hardware state"
+ "failed, error code is %ld!\n", PTR_ERR(buf));
+ } else {
+ par->vbe_state_orig = buf;
+ }
+ }
atomic_inc(&par->ref_count);
return 0;