mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/1] cpufreq: loongson3: Check for error code from devm_mutex_init() call
@ 2024-10-31 13:46 Andy Shevchenko
  2024-11-08  9:27 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2024-10-31 13:46 UTC (permalink / raw)
  To: Viresh Kumar, Huacai Chen, loongarch, linux-pm, linux-kernel
  Cc: WANG Xuerui, Rafael J. Wysocki, Andy Shevchenko

Even if it's not critical, the avoidance of checking the error code
from devm_mutex_init() call today diminishes the point of using devm
variant of it. Tomorrow it may even leak something. Add the missed
check.

Fixes: ccf51454145b ("cpufreq: Add Loongson-3 CPUFreq driver support")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: renamed loongson --> loongson3 in the Subject (Huacai)
 drivers/cpufreq/loongson3_cpufreq.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/loongson3_cpufreq.c b/drivers/cpufreq/loongson3_cpufreq.c
index 61ebebf69455..bd34bf0fafa5 100644
--- a/drivers/cpufreq/loongson3_cpufreq.c
+++ b/drivers/cpufreq/loongson3_cpufreq.c
@@ -346,8 +346,11 @@ static int loongson3_cpufreq_probe(struct platform_device *pdev)
 {
 	int i, ret;
 
-	for (i = 0; i < MAX_PACKAGES; i++)
-		devm_mutex_init(&pdev->dev, &cpufreq_mutex[i]);
+	for (i = 0; i < MAX_PACKAGES; i++) {
+		ret = devm_mutex_init(&pdev->dev, &cpufreq_mutex[i]);
+		if (ret)
+			return ret;
+	}
 
 	ret = do_service_request(0, 0, CMD_GET_VERSION, 0, 0);
 	if (ret <= 0)
-- 
2.43.0.rc1.1336.g36b5255a03ac


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

* Re: [PATCH v2 1/1] cpufreq: loongson3: Check for error code from devm_mutex_init() call
  2024-10-31 13:46 [PATCH v2 1/1] cpufreq: loongson3: Check for error code from devm_mutex_init() call Andy Shevchenko
@ 2024-11-08  9:27 ` Andy Shevchenko
  2024-11-11  4:11   ` Viresh Kumar
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2024-11-08  9:27 UTC (permalink / raw)
  To: Viresh Kumar, Huacai Chen, loongarch, linux-pm, linux-kernel
  Cc: WANG Xuerui, Rafael J. Wysocki

On Thu, Oct 31, 2024 at 03:46:34PM +0200, Andy Shevchenko wrote:
> Even if it's not critical, the avoidance of checking the error code
> from devm_mutex_init() call today diminishes the point of using devm
> variant of it. Tomorrow it may even leak something. Add the missed
> check.

Any comments? Can this be applied now for fixes, please?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 1/1] cpufreq: loongson3: Check for error code from devm_mutex_init() call
  2024-11-08  9:27 ` Andy Shevchenko
@ 2024-11-11  4:11   ` Viresh Kumar
  0 siblings, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2024-11-11  4:11 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Huacai Chen, loongarch, linux-pm, linux-kernel, WANG Xuerui,
	Rafael J. Wysocki

On 08-11-24, 11:27, Andy Shevchenko wrote:
> On Thu, Oct 31, 2024 at 03:46:34PM +0200, Andy Shevchenko wrote:
> > Even if it's not critical, the avoidance of checking the error code
> > from devm_mutex_init() call today diminishes the point of using devm
> > variant of it. Tomorrow it may even leak something. Add the missed
> > check.
> 
> Any comments? Can this be applied now for fixes, please?

Applied. Thanks.

-- 
viresh

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

end of thread, other threads:[~2024-11-11  4:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-31 13:46 [PATCH v2 1/1] cpufreq: loongson3: Check for error code from devm_mutex_init() call Andy Shevchenko
2024-11-08  9:27 ` Andy Shevchenko
2024-11-11  4:11   ` Viresh Kumar

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

all inboxes | Powered by JetHome®