From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Wang, Kevin(Yang)" Subject: Re: [PATCH] drm/amd/powerplay: Fix double unlock bug in smu_sys_set_pp_table() Date: Thu, 21 Mar 2019 07:06:07 +0000 Message-ID: References: <20190321062822.GD21489@kadam> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1385492889==" Return-path: In-Reply-To: <20190321062822.GD21489@kadam> Content-Language: en-US List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Sender: "amd-gfx" To: Dan Carpenter , "Deucher, Alexander" Cc: "Zhou, David(ChunMing)" , "Gui, Jack" , David Airlie , "kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org" , "Huang, Ray" , Daniel Vetter , "Gao, Likun" , "Koenig, Christian" --===============1385492889== Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MN2PR12MB3296E3B4F40A53AA743CF69DA2420MN2PR12MB3296namp_" --_000_MN2PR12MB3296E3B4F40A53AA743CF69DA2420MN2PR12MB3296namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 Thanks. Best Regards, Kevin ________________________________ From: Dan Carpenter 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-ja= nitors-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 sm= u11 (v2)") Signed-off-by: Dan Carpenter --- 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/a= md/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 =3D %d\n", ret); + return ret; + failed: mutex_unlock(&smu->mutex); return ret; -- 2.17.1 --_000_MN2PR12MB3296E3B4F40A53AA743CF69DA2420MN2PR12MB3296namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Dan,


Thank you for your careful attention to the problem.
I made the mistake of this patch, when we do code rebase internal= ly.
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 V= etter; Huang, Ray; Gao, Likun; Gui, Jack; amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org; ke= rnel-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 co= de unlocks twice on
the success path.

Fixes: 5809d7420f97 ("drm/amd/powerplay: implement sysfs of pp_table f= or 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/a= md/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,&n= bsp; void *buf, size_t size)
         if (ret)
            &nb= sp;    pr_info("smu reset failed, ret =3D %d\n", r= et);
 
+       return ret;
+
 failed:
         mutex_unlock(&smu->= mutex);
         return ret;
--
2.17.1

--_000_MN2PR12MB3296E3B4F40A53AA743CF69DA2420MN2PR12MB3296namp_-- --===============1385492889== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KYW1kLWdmeCBt YWlsaW5nIGxpc3QKYW1kLWdmeEBsaXN0cy5mcmVlZGVza3RvcC5vcmcKaHR0cHM6Ly9saXN0cy5m cmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9hbWQtZ2Z4 --===============1385492889==--