linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] hid: picolcd: testing the wrong variable
@ 2010-08-06  6:28 Dan Carpenter
  2010-08-06  8:08 ` Bruno Prémont
  2010-08-06 12:53 ` Jiri Kosina
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2010-08-06  6:28 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: Bruno Prémont, Jaya Kumar, linux-input, kernel-janitors

"ref_cnt" is a point to the reference count and it's non-null.  We really
want to test the reference count itself.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
index 346f0e3..c0bdeba 100644
--- a/drivers/hid/hid-picolcd.c
+++ b/drivers/hid/hid-picolcd.c
@@ -547,7 +547,7 @@ static void picolcd_fb_destroy(struct fb_info *info)
 	ref_cnt--;
 	mutex_lock(&info->lock);
 	(*ref_cnt)--;
-	may_release = !ref_cnt;
+	may_release = !*ref_cnt;
 	mutex_unlock(&info->lock);
 	if (may_release) {
 		framebuffer_release(info);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch] hid: picolcd: testing the wrong variable
  2010-08-06  6:28 [patch] hid: picolcd: testing the wrong variable Dan Carpenter
@ 2010-08-06  8:08 ` Bruno Prémont
  2010-08-06 12:54   ` Jiri Kosina
  2010-08-06 12:53 ` Jiri Kosina
  1 sibling, 1 reply; 4+ messages in thread
From: Bruno Prémont @ 2010-08-06  8:08 UTC (permalink / raw)
  To: Dan Carpenter, Jiri Kosina; +Cc: Jaya Kumar, linux-input, kernel-janitors

Thanks for spotting!

But while fixing this one also fix the ordering (which was never
reached due to this wrong check) a few lines later.

Patch (combined) at the end.

Thanks,
Bruno


On Fri, 6 Aug 2010 08:28:49 Dan Carpenter <error27@gmail.com> wrote:
> "ref_cnt" is a point to the reference count and it's non-null.  We really
> want to test the reference count itself.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
> index 346f0e3..c0bdeba 100644
> --- a/drivers/hid/hid-picolcd.c
> +++ b/drivers/hid/hid-picolcd.c
> @@ -547,7 +547,7 @@ static void picolcd_fb_destroy(struct fb_info *info)
>  	ref_cnt--;
>  	mutex_lock(&info->lock);
>  	(*ref_cnt)--;
> -	may_release = !ref_cnt;
> +	may_release = !*ref_cnt;
>  	mutex_unlock(&info->lock);
>  	if (may_release) {
>  		framebuffer_release(info);

--- a/drivers/hid/hid-picolcd.c
+++ b/drivers/hid/hid-picolcd.c
@@ -547,11 +547,11 @@ static void picolcd_fb_destroy(struct fb
 	ref_cnt--;
 	mutex_lock(&info->lock);
 	(*ref_cnt)--;
-	may_release = !ref_cnt;
+	may_release = !*ref_cnt;
 	mutex_unlock(&info->lock);
 	if (may_release) {
-		framebuffer_release(info);
 		vfree((u8 *)info->fix.smem_start);
+		framebuffer_release(info);
 	}
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] hid: picolcd: testing the wrong variable
  2010-08-06  6:28 [patch] hid: picolcd: testing the wrong variable Dan Carpenter
  2010-08-06  8:08 ` Bruno Prémont
@ 2010-08-06 12:53 ` Jiri Kosina
  1 sibling, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2010-08-06 12:53 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Bruno Prémont, Jaya Kumar, linux-input, kernel-janitors

On Fri, 6 Aug 2010, Dan Carpenter wrote:

> "ref_cnt" is a point to the reference count and it's non-null.  We really
> want to test the reference count itself.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
> index 346f0e3..c0bdeba 100644
> --- a/drivers/hid/hid-picolcd.c
> +++ b/drivers/hid/hid-picolcd.c
> @@ -547,7 +547,7 @@ static void picolcd_fb_destroy(struct fb_info *info)
>  	ref_cnt--;
>  	mutex_lock(&info->lock);
>  	(*ref_cnt)--;
> -	may_release = !ref_cnt;
> +	may_release = !*ref_cnt;
>  	mutex_unlock(&info->lock);
>  	if (may_release) {
>  		framebuffer_release(info);

Thanks a lot for spotting this. Applied.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] hid: picolcd: testing the wrong variable
  2010-08-06  8:08 ` Bruno Prémont
@ 2010-08-06 12:54   ` Jiri Kosina
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Kosina @ 2010-08-06 12:54 UTC (permalink / raw)
  To: Bruno Prémont
  Cc: Dan Carpenter, Jaya Kumar, linux-input, kernel-janitors

On Fri, 6 Aug 2010, Bruno Prémont wrote:

> Thanks for spotting!
> 
> But while fixing this one also fix the ordering (which was never
> reached due to this wrong check) a few lines later.
> 
> Patch (combined) at the end.
> 
> Thanks,
> Bruno
> 
> 
> On Fri, 6 Aug 2010 08:28:49 Dan Carpenter <error27@gmail.com> wrote:
> > "ref_cnt" is a point to the reference count and it's non-null.  We really
> > want to test the reference count itself.
> > 
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> > 
> > diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
> > index 346f0e3..c0bdeba 100644
> > --- a/drivers/hid/hid-picolcd.c
> > +++ b/drivers/hid/hid-picolcd.c
> > @@ -547,7 +547,7 @@ static void picolcd_fb_destroy(struct fb_info *info)
> >  	ref_cnt--;
> >  	mutex_lock(&info->lock);
> >  	(*ref_cnt)--;
> > -	may_release = !ref_cnt;
> > +	may_release = !*ref_cnt;
> >  	mutex_unlock(&info->lock);
> >  	if (may_release) {
> >  		framebuffer_release(info);
> 
> --- a/drivers/hid/hid-picolcd.c
> +++ b/drivers/hid/hid-picolcd.c
> @@ -547,11 +547,11 @@ static void picolcd_fb_destroy(struct fb
>  	ref_cnt--;
>  	mutex_lock(&info->lock);
>  	(*ref_cnt)--;
> -	may_release = !ref_cnt;
> +	may_release = !*ref_cnt;
>  	mutex_unlock(&info->lock);
>  	if (may_release) {
> -		framebuffer_release(info);
>  		vfree((u8 *)info->fix.smem_start);
> +		framebuffer_release(info);
>  	}
>  }

I have applied the patch fixing the ordering, along with adding

	Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>

to it. Please shoud if that is not proper.

Thanks,

-- 
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-08-06 12:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06  6:28 [patch] hid: picolcd: testing the wrong variable Dan Carpenter
2010-08-06  8:08 ` Bruno Prémont
2010-08-06 12:54   ` Jiri Kosina
2010-08-06 12:53 ` Jiri Kosina

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).