hid: picolcd: testing the wrong variable
Subsystems (3)
PATCH 1/1 hid: picolcd: testing the wrong variable
"ref_cnt" is a point to the reference count and it's non-null. We really want to test the reference count itself.
drivers/hid/hid-picolcd.c +1 -1
@@ -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);
Bruno Prémont
maintainerThanks 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
Quoted 10 lines · On Fri, 6 Aug 2010 08:28:49 Dan Carpenter <[email protected]> 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 <[email protected]>drivers/hid/hid-picolcd.c +0
-0
drivers/hid/hid-picolcd.c static void picolcd_fb_destroy(struct fb_info *info) · line 553
Quoted 8 lines
drivers/hid/hid-picolcd.c +1
-1@@ -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);
drivers/hid/hid-picolcd.c +2 -2
@@ -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); } }
Quoted 36 lines · Bruno Prémont
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,
BrunoQuoted 18 lines · On Fri, 6 Aug 2010 08:28:49 Dan Carpenter <[email protected]> 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 <[email protected]>drivers/hid/hid-picolcd.c +1
-1@@ -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);drivers/hid/hid-picolcd.c +0
-0@@ -547,11 +547,11 @@ static void picolcd_fb_destroy(struct fb ref_cnt--;mutex_lock (&info->lock);
drivers/hid/hid-picolcd.c static void picolcd_fb_destroy(struct fb · line 556
Quoted 10 lines
drivers/hid/hid-picolcd.c +2
-2(*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
to it. Please shoud if that is not proper.
Thanks,
Signature · 6 lines
Jiri Kosina SUSE Labs, Novell Inc. -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Dan Carpenter
"
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 <[email protected]>drivers/hid/hid-picolcd.c +0
-0
drivers/hid/hid-picolcd.c static void picolcd_fb_destroy(struct fb_info *info) · line 553
Quoted 8 lines
drivers/hid/hid-picolcd.c +1
-1@@ -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.
Signature · 2 lines
Jiri Kosina SUSE Labs, Novell Inc.