diff mbox series

[-next] thermal: armada: fix return value check in armada_thermal_probe_legacy()

Message ID 1532918524-46054-1-git-send-email-weiyongjun1@huawei.com (mailing list archive)
State Superseded, archived
Headers show
Series [-next] thermal: armada: fix return value check in armada_thermal_probe_legacy() | expand

Commit Message

Wei Yongjun July 30, 2018, 2:42 a.m. UTC
In case of error, the function platform_get_resource() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test.

Fixes: 175637792d45 ("thermal: armada: convert driver to syscon register accesses")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/thermal/armada_thermal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Daniel Lezcano July 30, 2018, 6:18 a.m. UTC | #1
On 30/07/2018 04:42, Wei Yongjun wrote:
> In case of error, the function platform_get_resource() returns NULL
> pointer not ERR_PTR(). The IS_ERR() test in the return value check
> should be replaced with NULL test.
> 
> Fixes: 175637792d45 ("thermal: armada: convert driver to syscon register accesses")
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---

Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Miquel Raynal July 30, 2018, 7:35 a.m. UTC | #2
Hi Daniel,

Daniel Lezcano <daniel.lezcano@linaro.org> wrote on Mon, 30 Jul 2018
08:18:53 +0200:

> On 30/07/2018 04:42, Wei Yongjun wrote:
> > In case of error, the function platform_get_resource() returns NULL
> > pointer not ERR_PTR(). The IS_ERR() test in the return value check
> > should be replaced with NULL test.
> > 
> > Fixes: 175637792d45 ("thermal: armada: convert driver to syscon register accesses")
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---  
> 
> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> 
> 

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
diff mbox series

Patch

diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 8de4ba5..6782814 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -526,8 +526,8 @@  static int armada_thermal_probe_legacy(struct platform_device *pdev,
 
 	/* First memory region points towards the status register */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (IS_ERR(res))
-		return PTR_ERR(res);
+	if (!res)
+		return -EINVAL;
 
 	/*
 	 * Edit the resource start address and length to map over all the