From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Thu, 21 Mar 2019 08:23:29 +0000 Subject: Re: [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table() Message-Id: <20190321082329.GV2227@kadam> List-Id: References: <20190321062822.GD21489@kadam> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 ; Wang, Kevin(Yang) > > > > > > Cc: Koenig, Christian ; Zhou, David(ChunMing) > > > ; David Airlie ; Daniel Vetter > > > ; Huang, Ray ; Gao, Likun > > > ; Gui, Jack ; 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 > > > > Nice catch! Thanks, Dan. > > Kevin, could you please verify this patch. > > Reviewed-by: Huang Rui > > > > > --- > > > 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