diff options
author | Wang YanQing <udknight@gmail.com> | 2012-03-01 20:45:31 -0500 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2012-03-08 13:13:10 -0500 |
commit | c2bc0a756b1f98bd712fabe78eb49d7d5ae72075 (patch) | |
tree | bbfbfd8be4ca41308f3ac768f969b46aec93eb3e | |
parent | ec0d22e4d563e7cce9f6678e2000900755c2989d (diff) |
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>
-rw-r--r-- | drivers/video/uvesafb.c | 14 |
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) | |||
363 | 363 | ||
364 | state = kmalloc(par->vbe_state_size, GFP_KERNEL); | 364 | state = kmalloc(par->vbe_state_size, GFP_KERNEL); |
365 | if (!state) | 365 | if (!state) |
366 | return NULL; | 366 | return ERR_PTR(-ENOMEM); |
367 | 367 | ||
368 | task = uvesafb_prep(); | 368 | task = uvesafb_prep(); |
369 | if (!task) { | 369 | if (!task) { |
@@ -1180,9 +1180,17 @@ static int uvesafb_open(struct fb_info *info, int user) | |||
1180 | { | 1180 | { |
1181 | struct uvesafb_par *par = info->par; | 1181 | struct uvesafb_par *par = info->par; |
1182 | int cnt = atomic_read(&par->ref_count); | 1182 | int cnt = atomic_read(&par->ref_count); |
1183 | u8 *buf = NULL; | ||
1183 | 1184 | ||
1184 | if (!cnt && par->vbe_state_size) | 1185 | if (!cnt && par->vbe_state_size) { |
1185 | par->vbe_state_orig = uvesafb_vbe_state_save(par); | 1186 | buf = uvesafb_vbe_state_save(par); |
1187 | if (IS_ERR(buf)) { | ||
1188 | printk(KERN_WARNING "uvesafb: save hardware state" | ||
1189 | "failed, error code is %ld!\n", PTR_ERR(buf)); | ||
1190 | } else { | ||
1191 | par->vbe_state_orig = buf; | ||
1192 | } | ||
1193 | } | ||
1186 | 1194 | ||
1187 | atomic_inc(&par->ref_count); | 1195 | atomic_inc(&par->ref_count); |
1188 | return 0; | 1196 | return 0; |