Commit 809eb350 authored by Wei Yongjun's avatar Wei Yongjun Committed by Zhang Rui

thermal: qcom: tsens: Fix return value check in init_common()

In case of error, the function of_iomap() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.
And the function devm_regmap_init_mmio() returns ERR_PTR()
and never returns NULL. The NULL test in the return value
check should be replaced with IS_ERR().
Signed-off-by: default avatarWei Yongjun <weiyj.lk@gmail.com>
Acked-by: default avatarRajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
parent 5ef62de7
...@@ -128,13 +128,13 @@ int __init init_common(struct tsens_device *tmdev) ...@@ -128,13 +128,13 @@ int __init init_common(struct tsens_device *tmdev)
void __iomem *base; void __iomem *base;
base = of_iomap(tmdev->dev->of_node, 0); base = of_iomap(tmdev->dev->of_node, 0);
if (IS_ERR(base)) if (!base)
return -EINVAL; return -EINVAL;
tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config); tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config);
if (!tmdev->map) { if (IS_ERR(tmdev->map)) {
iounmap(base); iounmap(base);
return -ENODEV; return PTR_ERR(tmdev->map);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment