* [PATCH] video:uvesafb: notice user when we failed to save hardware state
@ 2012-03-02 1:45 Wang YanQing
2012-03-21 18:35 ` Florian Tobias Schandinat
0 siblings, 1 reply; 2+ messages in thread
From: Wang YanQing @ 2012-03-02 1:45 UTC (permalink / raw)
To: spock; +Cc: FlorianSchandinat, linux-fbdev, linux-kernel
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>
---
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;
--
1.7.9.2.315.g25a78
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] video:uvesafb: notice user when we failed to save hardware state
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
0 siblings, 0 replies; 2+ messages in thread
From: Florian Tobias Schandinat @ 2012-03-21 18:35 UTC (permalink / raw)
To: Wang YanQing, spock, linux-fbdev, linux-kernel
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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-21 18:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).