From: Wei Yongjun Date: Sat, 30 Jul 2016 06:32:37 +0000 (+0000) Subject: thermal: qcom: tsens: Fix return value check in init_common() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=809eb35045097bc7da56fa8bba1f6b4cd1b721ba;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git 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 Acked-by: Rajendra Nayak Signed-off-by: Zhang Rui --- diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 4a1af151bd53..b1449ad67fc0 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -128,13 +128,13 @@ int __init init_common(struct tsens_device *tmdev) void __iomem *base; base = of_iomap(tmdev->dev->of_node, 0); - if (IS_ERR(base)) + if (!base) return -EINVAL; tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config); - if (!tmdev->map) { + if (IS_ERR(tmdev->map)) { iounmap(base); - return -ENODEV; + return PTR_ERR(tmdev->map); } return 0;