Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: ccf51454145b ("cpufreq: Add Loongson-3 CPUFreq driver support")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

authored by

Andy Shevchenko and committed by
Viresh Kumar
db01e466 8c776a54

+5 -2
+5 -2
drivers/cpufreq/loongson3_cpufreq.c
··· 346 346 { 347 347 int i, ret; 348 348 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 + } 351 354 352 355 ret = do_service_request(0, 0, CMD_GET_VERSION, 0, 0); 353 356 if (ret <= 0)