* [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table()
@ 2019-03-21 6:28 ` Dan Carpenter
0 siblings, 0 replies; 11+ 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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* RE: [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
-1 siblings, 0 replies; 11+ 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,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, 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] 11+ messages in thread
* RE: [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table()
@ 2019-03-21 6:52 ` Huang, Ray
0 siblings, 0 replies; 11+ 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,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, 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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 11+ 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
0 siblings, 0 replies; 11+ 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,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, 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] 11+ 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
0 siblings, 0 replies; 11+ 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,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, 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
>
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 11+ 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
-1 siblings, 0 replies; 11+ 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,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, 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] 11+ 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
0 siblings, 0 replies; 11+ 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,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, 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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 11+ 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
-1 siblings, 0 replies; 11+ 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,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, 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] 11+ messages in thread
* Re: [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table()
@ 2019-03-21 8:26 ` Julia Lawall
0 siblings, 0 replies; 11+ 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,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, 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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table()
2019-03-21 6:28 ` Dan Carpenter
(?)
(?)
@ 2019-03-21 7:06 ` Wang, Kevin(Yang)
-1 siblings, 0 replies; 11+ messages in thread
From: Wang, Kevin(Yang) @ 2019-03-21 7:06 UTC (permalink / raw)
To: Dan Carpenter, Deucher, Alexander
Cc: Zhou, David(ChunMing),
Gui, Jack, David Airlie, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Huang, Ray,
Daniel Vetter, Gao, Likun, Koenig, Christian
[-- Attachment #1.1: Type: text/plain, Size: 1843 bytes --]
Hi Dan,
Thank you for your careful attention to the problem.
I made the mistake of this patch, when we do code rebase internally.
and your patch is looks fine for me.
Reviewed-by: Kevin Wang <kevin1.wang-5C7GfCeVMHo@public.gmane.org>
Thanks.
Best Regards,
Kevin
________________________________
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Sent: Thursday, March 21, 2019 2:28:22 PM
To: Deucher, Alexander; Wang, Kevin(Yang)
Cc: Koenig, Christian; Zhou, David(ChunMing); David Airlie; Daniel Vetter; Huang, Ray; Gao, Likun; Gui, Jack; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org; kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.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-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
---
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
[-- Attachment #1.2: Type: text/html, Size: 3395 bytes --]
[-- Attachment #2: Type: text/plain, Size: 153 bytes --]
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread