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

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: Wei Yongjun <weiyj.lk@gmail.com>
Acked-by: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>

authored by

Wei Yongjun and committed by
Zhang Rui
809eb350 5ef62de7

+3 -3
+3 -3
drivers/thermal/qcom/tsens-common.c
··· 128 128 void __iomem *base; 129 129 130 130 base = of_iomap(tmdev->dev->of_node, 0); 131 - if (IS_ERR(base)) 131 + if (!base) 132 132 return -EINVAL; 133 133 134 134 tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config); 135 - if (!tmdev->map) { 135 + if (IS_ERR(tmdev->map)) { 136 136 iounmap(base); 137 - return -ENODEV; 137 + return PTR_ERR(tmdev->map); 138 138 } 139 139 140 140 return 0;