Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -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;