Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2bc0a75 authored by Wang YanQing's avatar Wang YanQing Committed by Florian Tobias Schandinat
Browse files

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: default avatarWang YanQing <udknight@gmail.com>
Signed-off-by: default avatarFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
parent ec0d22e4
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -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;