Skip to content

Commit

Permalink
cpufreq: qcom-hw: Fix return value check in qcom_cpufreq_hw_cpu_init()
Browse files Browse the repository at this point in the history
In case of error, the function ioremap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Fixes: 67fc209 ("cpufreq: qcom-hw: drop devm_xxx() calls from init/exit hooks")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
  • Loading branch information
Wei Yongjun authored and Viresh Kumar committed Mar 8, 2021
1 parent 02fc409 commit 536eb97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/cpufreq/qcom-cpufreq-hw.c
Original file line number Diff line number Diff line change
@@ -317,9 +317,9 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
}

base = ioremap(res->start, resource_size(res));
if (IS_ERR(base)) {
if (!base) {
dev_err(dev, "failed to map resource %pR\n", res);
ret = PTR_ERR(base);
ret = -ENOMEM;
goto release_region;
}

0 comments on commit 536eb97

Please sign in to comment.