Skip to content

Commit

Permalink
cpufreq: loongson3: Check for error code from devm_mutex_init() call
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
andy-shev authored and vireshk committed Nov 11, 2024
1 parent 8c776a5 commit db01e46
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/cpufreq/loongson3_cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit db01e46

Please sign in to comment.