linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
To: Wang YanQing <Udknight@gmail.com>,
	spock@gentoo.org, linux-fbdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] video:uvesafb: notice user when we failed to save hardware state
Date: Wed, 21 Mar 2012 18:35:51 +0000	[thread overview]
Message-ID: <4F6A1F87.6010806@gmx.de> (raw)
In-Reply-To: <20120302014531.GA3597@udknight>

On 03/02/2012 01:45 AM, Wang YanQing wrote:
> 
> 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>

Applied.


Thanks,

Florian Tobias Schandinat

> ---
>  drivers/video/uvesafb.c |   14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
> index e7f69ef..9db3de3 100644
> --- a/drivers/video/uvesafb.c
> +++ b/drivers/video/uvesafb.c
> @@ -362,7 +362,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) {
> @@ -1172,9 +1172,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;


      reply	other threads:[~2012-03-21 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02  1:45 [PATCH] video:uvesafb: notice user when we failed to save hardware state Wang YanQing
2012-03-21 18:35 ` Florian Tobias Schandinat [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F6A1F87.6010806@gmx.de \
    --to=florianschandinat@gmx.de \
    --cc=Udknight@gmail.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spock@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).