* [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table()
@ 2019-03-21 6:28 Dan Carpenter
2019-03-21 6:52 ` Huang, Ray
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2019-03-21 6:28 UTC (permalink / raw)
To: Alex Deucher, Kevin Wang
Cc: David (ChunMing) Zhou, Chengming Gui, David Airlie,
kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Huang Rui,
Daniel Vetter, Likun Gao, Christian König
We already unlocked a few lines earlier so this code unlocks twice on
the success path.
Fixes: 5809d7420f97 ("drm/amd/powerplay: implement sysfs of pp_table for smu11 (v2)")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I'm not sure what this bug looks like at runtime, but it's slightly
weird that no one noticed. This is from static analysis and I haven't
tested it myself.
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 00b7c885772b..7e8c74da6a74 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -187,6 +187,8 @@ int smu_sys_set_pp_table(struct smu_context *smu, void *buf, size_t size)
if (ret)
pr_info("smu reset failed, ret = %d\n", ret);
+ return ret;
+
failed:
mutex_unlock(&smu->mutex);
return ret;
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* RE: [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table() 2019-03-21 6:28 [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table() Dan Carpenter @ 2019-03-21 6:52 ` Huang, Ray [not found] ` <MN2PR12MB3309B7C391B32EB8F5F87676EC420-rweVpJHSKTpWdvXm18W95QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Huang, Ray @ 2019-03-21 6:52 UTC (permalink / raw) To: Dan Carpenter, Deucher, Alexander, Wang, Kevin(Yang) Cc: Zhou, David(ChunMing), Gui, Jack, David Airlie, kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Daniel Vetter, Gao, Likun, Koenig, Christian > -----Original Message----- > From: Dan Carpenter [mailto:dan.carpenter@oracle.com] > Sent: Thursday, March 21, 2019 2:28 PM > To: Deucher, Alexander <Alexander.Deucher@amd.com>; Wang, Kevin(Yang) > <Kevin1.Wang@amd.com> > Cc: Koenig, Christian <Christian.Koenig@amd.com>; Zhou, David(ChunMing) > <David1.Zhou@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter > <daniel@ffwll.ch>; Huang, Ray <Ray.Huang@amd.com>; Gao, Likun > <Likun.Gao@amd.com>; Gui, Jack <Jack.Gui@amd.com>; amd- > gfx@lists.freedesktop.org; kernel-janitors@vger.kernel.org > Subject: [PATCH] drm/amd/powerplay: Fix double unlock bug in > smu_sys_set_pp_table() > > We already unlocked a few lines earlier so this code unlocks twice on the > success path. > > Fixes: 5809d7420f97 ("drm/amd/powerplay: implement sysfs of pp_table for > smu11 (v2)") > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Nice catch! Thanks, Dan. Kevin, could you please verify this patch. Reviewed-by: Huang Rui <ray.huang@amd.com> > --- > I'm not sure what this bug looks like at runtime, but it's slightly weird that no > one noticed. This is from static analysis and I haven't tested it myself. > > drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > index 00b7c885772b..7e8c74da6a74 100644 > --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > @@ -187,6 +187,8 @@ int smu_sys_set_pp_table(struct smu_context *smu, > void *buf, size_t size) > if (ret) > pr_info("smu reset failed, ret = %d\n", ret); > > + return ret; > + > failed: > mutex_unlock(&smu->mutex); > return ret; > -- > 2.17.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <MN2PR12MB3309B7C391B32EB8F5F87676EC420-rweVpJHSKTpWdvXm18W95QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>]
* RE: [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table() [not found] ` <MN2PR12MB3309B7C391B32EB8F5F87676EC420-rweVpJHSKTpWdvXm18W95QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org> @ 2019-03-21 8:20 ` Julia Lawall 2019-03-21 8:23 ` Dan Carpenter 0 siblings, 1 reply; 5+ messages in thread From: Julia Lawall @ 2019-03-21 8:20 UTC (permalink / raw) To: Huang, Ray Cc: Zhou, David(ChunMing), Gui, Jack, David Airlie, Wang, Kevin(Yang), kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Daniel Vetter, Deucher, Alexander, Gao, Likun, Koenig, Christian, Dan Carpenter On Thu, 21 Mar 2019, Huang, Ray wrote: > > -----Original Message----- > > From: Dan Carpenter [mailto:dan.carpenter@oracle.com] > > Sent: Thursday, March 21, 2019 2:28 PM > > To: Deucher, Alexander <Alexander.Deucher@amd.com>; Wang, Kevin(Yang) > > <Kevin1.Wang@amd.com> > > Cc: Koenig, Christian <Christian.Koenig@amd.com>; Zhou, David(ChunMing) > > <David1.Zhou@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter > > <daniel@ffwll.ch>; Huang, Ray <Ray.Huang@amd.com>; Gao, Likun > > <Likun.Gao@amd.com>; Gui, Jack <Jack.Gui@amd.com>; amd- > > gfx@lists.freedesktop.org; kernel-janitors@vger.kernel.org > > Subject: [PATCH] drm/amd/powerplay: Fix double unlock bug in > > smu_sys_set_pp_table() > > > > We already unlocked a few lines earlier so this code unlocks twice on the > > success path. > > > > Fixes: 5809d7420f97 ("drm/amd/powerplay: implement sysfs of pp_table for > > smu11 (v2)") > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > > Nice catch! Thanks, Dan. > Kevin, could you please verify this patch. > Reviewed-by: Huang Rui <ray.huang@amd.com> > > > --- > > I'm not sure what this bug looks like at runtime, but it's slightly weird that no > > one noticed. This is from static analysis and I haven't tested it myself. > > > > drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > index 00b7c885772b..7e8c74da6a74 100644 > > --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > @@ -187,6 +187,8 @@ int smu_sys_set_pp_table(struct smu_context *smu, > > void *buf, size_t size) > > if (ret) > > pr_info("smu reset failed, ret = %d\n", ret); > > > > + return ret; Why not return 0? julia > > + > > failed: > > mutex_unlock(&smu->mutex); > > return ret; > > -- > > 2.17.1 > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table() 2019-03-21 8:20 ` Julia Lawall @ 2019-03-21 8:23 ` Dan Carpenter 2019-03-21 8:26 ` Julia Lawall 0 siblings, 1 reply; 5+ messages in thread From: Dan Carpenter @ 2019-03-21 8:23 UTC (permalink / raw) To: Julia Lawall Cc: Zhou, David(ChunMing), Gui, Jack, David Airlie, Wang, Kevin(Yang), kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Huang, Ray, Daniel Vetter, Deucher, Alexander, Gao, Likun, Koenig, Christian On Thu, Mar 21, 2019 at 09:20:38AM +0100, Julia Lawall wrote: > > > On Thu, 21 Mar 2019, Huang, Ray wrote: > > > > -----Original Message----- > > > From: Dan Carpenter [mailto:dan.carpenter@oracle.com] > > > Sent: Thursday, March 21, 2019 2:28 PM > > > To: Deucher, Alexander <Alexander.Deucher@amd.com>; Wang, Kevin(Yang) > > > <Kevin1.Wang@amd.com> > > > Cc: Koenig, Christian <Christian.Koenig@amd.com>; Zhou, David(ChunMing) > > > <David1.Zhou@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter > > > <daniel@ffwll.ch>; Huang, Ray <Ray.Huang@amd.com>; Gao, Likun > > > <Likun.Gao@amd.com>; Gui, Jack <Jack.Gui@amd.com>; amd- > > > gfx@lists.freedesktop.org; kernel-janitors@vger.kernel.org > > > Subject: [PATCH] drm/amd/powerplay: Fix double unlock bug in > > > smu_sys_set_pp_table() > > > > > > We already unlocked a few lines earlier so this code unlocks twice on the > > > success path. > > > > > > Fixes: 5809d7420f97 ("drm/amd/powerplay: implement sysfs of pp_table for > > > smu11 (v2)") > > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > > > > Nice catch! Thanks, Dan. > > Kevin, could you please verify this patch. > > Reviewed-by: Huang Rui <ray.huang@amd.com> > > > > > --- > > > I'm not sure what this bug looks like at runtime, but it's slightly weird that no > > > one noticed. This is from static analysis and I haven't tested it myself. > > > > > > drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > > b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > > index 00b7c885772b..7e8c74da6a74 100644 > > > --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > > +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > > @@ -187,6 +187,8 @@ int smu_sys_set_pp_table(struct smu_context *smu, > > > void *buf, size_t size) > > > if (ret) > > > pr_info("smu reset failed, ret = %d\n", ret); > > > > > > + return ret; > > Why not return 0? It's not necessarily zero. regards, dan carpenter ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table() 2019-03-21 8:23 ` Dan Carpenter @ 2019-03-21 8:26 ` Julia Lawall 0 siblings, 0 replies; 5+ messages in thread From: Julia Lawall @ 2019-03-21 8:26 UTC (permalink / raw) To: Dan Carpenter Cc: Zhou, David(ChunMing), Gui, Jack, David Airlie, Wang, Kevin(Yang), kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Julia Lawall, Huang, Ray, Daniel Vetter, Deucher, Alexander, Gao, Likun, Koenig, Christian On Thu, 21 Mar 2019, Dan Carpenter wrote: > On Thu, Mar 21, 2019 at 09:20:38AM +0100, Julia Lawall wrote: > > > > > > On Thu, 21 Mar 2019, Huang, Ray wrote: > > > > > > -----Original Message----- > > > > From: Dan Carpenter [mailto:dan.carpenter@oracle.com] > > > > Sent: Thursday, March 21, 2019 2:28 PM > > > > To: Deucher, Alexander <Alexander.Deucher@amd.com>; Wang, Kevin(Yang) > > > > <Kevin1.Wang@amd.com> > > > > Cc: Koenig, Christian <Christian.Koenig@amd.com>; Zhou, David(ChunMing) > > > > <David1.Zhou@amd.com>; David Airlie <airlied@linux.ie>; Daniel Vetter > > > > <daniel@ffwll.ch>; Huang, Ray <Ray.Huang@amd.com>; Gao, Likun > > > > <Likun.Gao@amd.com>; Gui, Jack <Jack.Gui@amd.com>; amd- > > > > gfx@lists.freedesktop.org; kernel-janitors@vger.kernel.org > > > > Subject: [PATCH] drm/amd/powerplay: Fix double unlock bug in > > > > smu_sys_set_pp_table() > > > > > > > > We already unlocked a few lines earlier so this code unlocks twice on the > > > > success path. > > > > > > > > Fixes: 5809d7420f97 ("drm/amd/powerplay: implement sysfs of pp_table for > > > > smu11 (v2)") > > > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > > > > > > Nice catch! Thanks, Dan. > > > Kevin, could you please verify this patch. > > > Reviewed-by: Huang Rui <ray.huang@amd.com> > > > > > > > --- > > > > I'm not sure what this bug looks like at runtime, but it's slightly weird that no > > > > one noticed. This is from static analysis and I haven't tested it myself. > > > > > > > > drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ > > > > 1 file changed, 2 insertions(+) > > > > > > > > diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > > > b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > > > index 00b7c885772b..7e8c74da6a74 100644 > > > > --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > > > +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c > > > > @@ -187,6 +187,8 @@ int smu_sys_set_pp_table(struct smu_context *smu, > > > > void *buf, size_t size) > > > > if (ret) > > > > pr_info("smu reset failed, ret = %d\n", ret); > > > > > > > > + return ret; > > > > Why not return 0? > > It's not necessarily zero. Oops, I was looking at the invisble goto after the pr_info :) julia ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-03-21 8:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-21 6:28 [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table() Dan Carpenter
2019-03-21 6:52 ` Huang, Ray
[not found] ` <MN2PR12MB3309B7C391B32EB8F5F87676EC420-rweVpJHSKTpWdvXm18W95QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-03-21 8:20 ` Julia Lawall
2019-03-21 8:23 ` Dan Carpenter
2019-03-21 8:26 ` Julia Lawall
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox