Skip to content

Commit db01e46

Browse files
andy-shevvireshk
authored andcommitted
cpufreq: loongson3: Check for error code from devm_mutex_init() call
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: ccf5145 ("cpufreq: Add Loongson-3 CPUFreq driver support") Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent 8c776a5 commit db01e46

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/cpufreq/loongson3_cpufreq.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,11 @@ static int loongson3_cpufreq_probe(struct platform_device *pdev)
346346
{
347347
int i, ret;
348348

349-
for (i = 0; i < MAX_PACKAGES; i++)
350-
devm_mutex_init(&pdev->dev, &cpufreq_mutex[i]);
349+
for (i = 0; i < MAX_PACKAGES; i++) {
350+
ret = devm_mutex_init(&pdev->dev, &cpufreq_mutex[i]);
351+
if (ret)
352+
return ret;
353+
}
351354

352355
ret = do_service_request(0, 0, CMD_GET_VERSION, 0, 0);
353356
if (ret <= 0)

0 commit comments

Comments
 (0)