Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] cpufreq: mediatek: Fix potential deadlock problem in mtk_cpufreq_set_target
@ 2022-05-10  9:05 Wan Jiabing
  2022-05-10  9:12 ` Viresh Kumar
  0 siblings, 1 reply; 8+ messages in thread
From: Wan Jiabing @ 2022-05-10  9:05 UTC (permalink / raw)
  To: Rafael J. Wysocki, Viresh Kumar, Matthias Brugger, Rex-BC Chen,
	AngeloGioacchino Del Regno, Jia-Wei Chang, Andrew-sh.Cheng,
	linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek
  Cc: Wan Jiabing

Fix following coccichek error:
./drivers/cpufreq/mediatek-cpufreq.c:199:2-8: preceding lock on line
./drivers/cpufreq/mediatek-cpufreq.c:208:2-8: preceding lock on line

mutex_lock is acquired but not released before return.
Use 'goto out' to help releasing the mutex_lock.

Fixes: c210063b40ac ("cpufreq: mediatek: Add opp notification support")
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
Changelog:
v2:
- Fix a typo in 'Fixes' tag.
---
 drivers/cpufreq/mediatek-cpufreq.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c
index 75bf21ddf61f..4c6d53c99d79 100644
--- a/drivers/cpufreq/mediatek-cpufreq.c
+++ b/drivers/cpufreq/mediatek-cpufreq.c
@@ -196,7 +196,8 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy,
 
 	if (pre_vproc < 0) {
 		dev_err(cpu_dev, "invalid Vproc value: %d\n", pre_vproc);
-		return pre_vproc;
+		ret = pre_vproc;
+		goto out;
 	}
 
 	freq_hz = freq_table[index].frequency * 1000;
@@ -205,7 +206,8 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy,
 	if (IS_ERR(opp)) {
 		dev_err(cpu_dev, "cpu%d: failed to find OPP for %ld\n",
 			policy->cpu, freq_hz);
-		return PTR_ERR(opp);
+		ret = PTR_ERR(opp);
+		goto out;
 	}
 	vproc = dev_pm_opp_get_voltage(opp);
 	dev_pm_opp_put(opp);
-- 
2.35.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] cpufreq: mediatek: Fix potential deadlock problem in mtk_cpufreq_set_target
  2022-05-10  9:05 [PATCH v2] cpufreq: mediatek: Fix potential deadlock problem in mtk_cpufreq_set_target Wan Jiabing
@ 2022-05-10  9:12 ` Viresh Kumar
  2022-05-10  9:23   ` Jiabing Wan
  0 siblings, 1 reply; 8+ messages in thread
From: Viresh Kumar @ 2022-05-10  9:12 UTC (permalink / raw)
  To: Wan Jiabing
  Cc: Rafael J. Wysocki, Matthias Brugger, Rex-BC Chen,
	AngeloGioacchino Del Regno, Jia-Wei Chang, Andrew-sh.Cheng,
	linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek

On 10-05-22, 17:05, Wan Jiabing wrote:
> Fix following coccichek error:
> ./drivers/cpufreq/mediatek-cpufreq.c:199:2-8: preceding lock on line
> ./drivers/cpufreq/mediatek-cpufreq.c:208:2-8: preceding lock on line
> 
> mutex_lock is acquired but not released before return.
> Use 'goto out' to help releasing the mutex_lock.
> 
> Fixes: c210063b40ac ("cpufreq: mediatek: Add opp notification support")
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>

You should have added the review tag you received.

Applied. Thanks.

-- 
viresh

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] cpufreq: mediatek: Fix potential deadlock problem in mtk_cpufreq_set_target
  2022-05-10  9:12 ` Viresh Kumar
@ 2022-05-10  9:23   ` Jiabing Wan
  2022-05-10  9:28     ` Viresh Kumar
  0 siblings, 1 reply; 8+ messages in thread
From: Jiabing Wan @ 2022-05-10  9:23 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J. Wysocki, Matthias Brugger, Rex-BC Chen,
	AngeloGioacchino Del Regno, Jia-Wei Chang, Andrew-sh.Cheng,
	linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek



On 2022/5/10 17:12, Viresh Kumar wrote:
> On 10-05-22, 17:05, Wan Jiabing wrote:
>> Fix following coccichek error:
>> ./drivers/cpufreq/mediatek-cpufreq.c:199:2-8: preceding lock on line
>> ./drivers/cpufreq/mediatek-cpufreq.c:208:2-8: preceding lock on line
>>
>> mutex_lock is acquired but not released before return.
>> Use 'goto out' to help releasing the mutex_lock.
>>
>> Fixes: c210063b40ac ("cpufreq: mediatek: Add opp notification support")
>> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> You should have added the review tag you received.
>
> Applied. Thanks.

Oh, yes.  I would add the "Reviewed-by:" tag only if someone sends
this tag to me.

Like:
[0] https://lore.kernel.org/all/YnkvM5iuSuAOqBg+@lunn.ch/
[1] 
https://lore.kernel.org/all/20220510015521.2542096-1-wanjiabing@vivo.com/

If not explicitly stated, I am afraid to add some wrong "Reviewed-by:"
tags which might bother maintainers.

Thanks a lot for your priceless advice!

Wan Jiabing





_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] cpufreq: mediatek: Fix potential deadlock problem in mtk_cpufreq_set_target
  2022-05-10  9:23   ` Jiabing Wan
@ 2022-05-10  9:28     ` Viresh Kumar
  2022-05-10  9:36       ` Jiabing Wan
  2022-05-10 11:23       ` Rex-BC Chen
  0 siblings, 2 replies; 8+ messages in thread
From: Viresh Kumar @ 2022-05-10  9:28 UTC (permalink / raw)
  To: Jiabing Wan
  Cc: Rafael J. Wysocki, Matthias Brugger, Rex-BC Chen,
	AngeloGioacchino Del Regno, Jia-Wei Chang, Andrew-sh.Cheng,
	linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek

On 10-05-22, 17:23, Jiabing Wan wrote:
> 
> 
> On 2022/5/10 17:12, Viresh Kumar wrote:
> > On 10-05-22, 17:05, Wan Jiabing wrote:
> > > Fix following coccichek error:
> > > ./drivers/cpufreq/mediatek-cpufreq.c:199:2-8: preceding lock on line
> > > ./drivers/cpufreq/mediatek-cpufreq.c:208:2-8: preceding lock on line
> > > 
> > > mutex_lock is acquired but not released before return.
> > > Use 'goto out' to help releasing the mutex_lock.
> > > 
> > > Fixes: c210063b40ac ("cpufreq: mediatek: Add opp notification support")
> > > Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> > You should have added the review tag you received.
> > 
> > Applied. Thanks.
> 
> Oh, yes.  I would add the "Reviewed-by:" tag only if someone sends
> this tag to me.

Didn't you get this ?

https://lore.kernel.org/linux-mediatek/304e7eefbb57e9c938737b64fbb515201c7944b8.camel@mediatek.com/

Rex, are you subscribed to LKML ? You can't send an email there without
subscription. I don't see this email on LKML lore.

-- 
viresh

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] cpufreq: mediatek: Fix potential deadlock problem in mtk_cpufreq_set_target
  2022-05-10  9:28     ` Viresh Kumar
@ 2022-05-10  9:36       ` Jiabing Wan
  2022-05-10 11:23       ` Rex-BC Chen
  1 sibling, 0 replies; 8+ messages in thread
From: Jiabing Wan @ 2022-05-10  9:36 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rafael J. Wysocki, Matthias Brugger, Rex-BC Chen,
	AngeloGioacchino Del Regno, Jia-Wei Chang, Andrew-sh.Cheng,
	linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek



On 2022/5/10 17:28, Viresh Kumar wrote:
> On 10-05-22, 17:23, Jiabing Wan wrote:
>>
>> On 2022/5/10 17:12, Viresh Kumar wrote:
>>> On 10-05-22, 17:05, Wan Jiabing wrote:
>>>> Fix following coccichek error:
>>>> ./drivers/cpufreq/mediatek-cpufreq.c:199:2-8: preceding lock on line
>>>> ./drivers/cpufreq/mediatek-cpufreq.c:208:2-8: preceding lock on line
>>>>
>>>> mutex_lock is acquired but not released before return.
>>>> Use 'goto out' to help releasing the mutex_lock.
>>>>
>>>> Fixes: c210063b40ac ("cpufreq: mediatek: Add opp notification support")
>>>> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
>>> You should have added the review tag you received.
>>>
>>> Applied. Thanks.
>> Oh, yes.  I would add the "Reviewed-by:" tag only if someone sends
>> this tag to me.
> Didn't you get this ?
>
> https://lore.kernel.org/linux-mediatek/304e7eefbb57e9c938737b64fbb515201c7944b8.camel@mediatek.com/

Oh, sorry! there might be some problem in my email-server.
I didn't get this email and I also didn't see this email on LKML lore.

So I missed this email.
Sorry for my mistake.

Wan Jiabing



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] cpufreq: mediatek: Fix potential deadlock problem in mtk_cpufreq_set_target
  2022-05-10  9:28     ` Viresh Kumar
  2022-05-10  9:36       ` Jiabing Wan
@ 2022-05-10 11:23       ` Rex-BC Chen
  2022-05-11  3:11         ` Viresh Kumar
  1 sibling, 1 reply; 8+ messages in thread
From: Rex-BC Chen @ 2022-05-10 11:23 UTC (permalink / raw)
  To: Viresh Kumar, Jiabing Wan
  Cc: Rafael J. Wysocki, Matthias Brugger, AngeloGioacchino Del Regno,
	Jia-Wei Chang, Andrew-sh.Cheng, linux-pm, linux-kernel,
	linux-arm-kernel, linux-mediatek

On Tue, 2022-05-10 at 14:58 +0530, Viresh Kumar wrote:
> On 10-05-22, 17:23, Jiabing Wan wrote:
> > 
> > 
> > On 2022/5/10 17:12, Viresh Kumar wrote:
> > > On 10-05-22, 17:05, Wan Jiabing wrote:
> > > > Fix following coccichek error:
> > > > ./drivers/cpufreq/mediatek-cpufreq.c:199:2-8: preceding lock on
> > > > line
> > > > ./drivers/cpufreq/mediatek-cpufreq.c:208:2-8: preceding lock on
> > > > line
> > > > 
> > > > mutex_lock is acquired but not released before return.
> > > > Use 'goto out' to help releasing the mutex_lock.
> > > > 
> > > > Fixes: c210063b40ac ("cpufreq: mediatek: Add opp notification
> > > > support")
> > > > Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> > > 
> > > You should have added the review tag you received.
> > > 
> > > Applied. Thanks.
> > 
> > Oh, yes.  I would add the "Reviewed-by:" tag only if someone sends
> > this tag to me.
> 
> Didn't you get this ?
> 
> 
https://lore.kernel.org/linux-mediatek/304e7eefbb57e9c938737b64fbb515201c7944b8.camel@mediatek.com/
> 
> Rex, are you subscribed to LKML ? You can't send an email there
> without
> subscription. I don't see this email on LKML lore.
> 

Hello Viresh,

I am not sure what's the problem.
But I subscribed the linux-arm-kernel mailing list and linux-mediatek.

As for LKML, do you mean subscribe "List: linux-kernel;" in [1]?

[1]: http://vger.kernel.org/vger-lists.html

BRs,
Rex


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] cpufreq: mediatek: Fix potential deadlock problem in mtk_cpufreq_set_target
  2022-05-10 11:23       ` Rex-BC Chen
@ 2022-05-11  3:11         ` Viresh Kumar
  2022-05-11  3:23           ` Rex-BC Chen
  0 siblings, 1 reply; 8+ messages in thread
From: Viresh Kumar @ 2022-05-11  3:11 UTC (permalink / raw)
  To: Rex-BC Chen
  Cc: Jiabing Wan, Rafael J. Wysocki, Matthias Brugger,
	AngeloGioacchino Del Regno, Jia-Wei Chang, Andrew-sh.Cheng,
	linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek

On 10-05-22, 19:23, Rex-BC Chen wrote:
> I am not sure what's the problem.
> But I subscribed the linux-arm-kernel mailing list and linux-mediatek.
> 
> As for LKML, do you mean subscribe "List: linux-kernel;" in [1]?

Yes, this is one of the most useful email lists and mostly gets cc'd anyway, you
can disable mail delivery if you don't want to get emails.

I asked because I couldn't find your email in https://lore.kernel.org/lkml, but
its fine either way.

-- 
viresh

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] cpufreq: mediatek: Fix potential deadlock problem in mtk_cpufreq_set_target
  2022-05-11  3:11         ` Viresh Kumar
@ 2022-05-11  3:23           ` Rex-BC Chen
  0 siblings, 0 replies; 8+ messages in thread
From: Rex-BC Chen @ 2022-05-11  3:23 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Jiabing Wan, Rafael J. Wysocki, Matthias Brugger,
	AngeloGioacchino Del Regno, Jia-Wei Chang, Andrew-sh.Cheng,
	linux-pm, linux-kernel, linux-arm-kernel, linux-mediatek

On Wed, 2022-05-11 at 08:41 +0530, Viresh Kumar wrote:
> On 10-05-22, 19:23, Rex-BC Chen wrote:
> > I am not sure what's the problem.
> > But I subscribed the linux-arm-kernel mailing list and linux-
> > mediatek.
> > 
> > As for LKML, do you mean subscribe "List: linux-kernel;" in [1]?
> 
> Yes, this is one of the most useful email lists and mostly gets cc'd
> anyway, you
> can disable mail delivery if you don't want to get emails.
> 
> I asked because I couldn't find your email in 
> https://lore.kernel.org/lkml, but
> its fine either way.
> 

Hello Viresh,

thanks for your suggestion.
I will try to subscribe this.

BRs,
Rex


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-05-11  3:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-10  9:05 [PATCH v2] cpufreq: mediatek: Fix potential deadlock problem in mtk_cpufreq_set_target Wan Jiabing
2022-05-10  9:12 ` Viresh Kumar
2022-05-10  9:23   ` Jiabing Wan
2022-05-10  9:28     ` Viresh Kumar
2022-05-10  9:36       ` Jiabing Wan
2022-05-10 11:23       ` Rex-BC Chen
2022-05-11  3:11         ` Viresh Kumar
2022-05-11  3:23           ` Rex-BC Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox