* [PATCH -next] thermal: qcom: tsens: Fix return value check in init_common()
@ 2016-07-30 6:32 Wei Yongjun
2016-08-10 4:59 ` Rajendra Nayak
2016-08-19 13:12 ` Zhang Rui
0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2016-07-30 6:32 UTC (permalink / raw)
To: Zhang Rui, Eduardo Valentin, Lina Iyer, Rajendra Nayak
Cc: Wei Yongjun, linux-pm
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>
---
drivers/thermal/qcom/tsens-common.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c
index 4a1af15..b1449ad 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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] thermal: qcom: tsens: Fix return value check in init_common()
2016-07-30 6:32 [PATCH -next] thermal: qcom: tsens: Fix return value check in init_common() Wei Yongjun
@ 2016-08-10 4:59 ` Rajendra Nayak
2016-08-19 13:12 ` Zhang Rui
1 sibling, 0 replies; 3+ messages in thread
From: Rajendra Nayak @ 2016-08-10 4:59 UTC (permalink / raw)
To: Wei Yongjun, Zhang Rui, Eduardo Valentin, Lina Iyer; +Cc: linux-pm
On 07/30/2016 12:02 PM, Wei Yongjun wrote:
> 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().
Thanks for fixing this, I seem to have mixed up the return types
for the two functions
Acked-by: Rajendra Nayak <rnayak@codeaurora.org>
>
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
> ---
> drivers/thermal/qcom/tsens-common.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c
> index 4a1af15..b1449ad 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;
>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] thermal: qcom: tsens: Fix return value check in init_common()
2016-07-30 6:32 [PATCH -next] thermal: qcom: tsens: Fix return value check in init_common() Wei Yongjun
2016-08-10 4:59 ` Rajendra Nayak
@ 2016-08-19 13:12 ` Zhang Rui
1 sibling, 0 replies; 3+ messages in thread
From: Zhang Rui @ 2016-08-19 13:12 UTC (permalink / raw)
To: Wei Yongjun, Eduardo Valentin, Lina Iyer, Rajendra Nayak; +Cc: linux-pm
On 六, 2016-07-30 at 00:32 -0600, Wei Yongjun wrote:
> 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>
Patch applied.
thanks,
rui
> ---
> drivers/thermal/qcom/tsens-common.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/thermal/qcom/tsens-common.c
> b/drivers/thermal/qcom/tsens-common.c
> index 4a1af15..b1449ad 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;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-19 13:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-30 6:32 [PATCH -next] thermal: qcom: tsens: Fix return value check in init_common() Wei Yongjun
2016-08-10 4:59 ` Rajendra Nayak
2016-08-19 13:12 ` Zhang Rui
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.