diff options
author | Wei Yongjun <weiyj.lk@gmail.com> | 2016-07-30 02:32:37 -0400 |
---|---|---|
committer | Zhang Rui <rui.zhang@intel.com> | 2016-09-27 02:02:16 -0400 |
commit | 809eb35045097bc7da56fa8bba1f6b4cd1b721ba (patch) | |
tree | 986d64eb56bb0bdfe8ae0a34112c33968a1ef9ec | |
parent | 5ef62de751dcd21b3853368ab47eedcbc1cf3475 (diff) |
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>
-rw-r--r-- | drivers/thermal/qcom/tsens-common.c | 6 |
1 files changed, 3 insertions, 3 deletions
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) | |||
128 | void __iomem *base; | 128 | void __iomem *base; |
129 | 129 | ||
130 | base = of_iomap(tmdev->dev->of_node, 0); | 130 | base = of_iomap(tmdev->dev->of_node, 0); |
131 | if (IS_ERR(base)) | 131 | if (!base) |
132 | return -EINVAL; | 132 | return -EINVAL; |
133 | 133 | ||
134 | tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config); | 134 | tmdev->map = devm_regmap_init_mmio(tmdev->dev, base, &tsens_config); |
135 | if (!tmdev->map) { | 135 | if (IS_ERR(tmdev->map)) { |
136 | iounmap(base); | 136 | iounmap(base); |
137 | return -ENODEV; | 137 | return PTR_ERR(tmdev->map); |
138 | } | 138 | } |
139 | 139 | ||
140 | return 0; | 140 | return 0; |