diff mbox series

thermal: armada: fix a test in probe()

Message ID 20180919103500.GB9238@mwanda (mailing list archive)
State Accepted
Delegated to: Eduardo Valentin
Headers show
Series thermal: armada: fix a test in probe() | expand

Commit Message

Dan Carpenter Sept. 19, 2018, 10:35 a.m. UTC
The platform_get_resource() function doesn't return error pointers, it
returns NULL on error.

Fixes: 3d4e51844a4e ("thermal: armada: convert driver to syscon register accesses")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Comments

Miquel Raynal Sept. 19, 2018, 11:35 a.m. UTC | #1
Hi Dan,

Dan Carpenter <dan.carpenter@oracle.com> wrote on Wed, 19 Sep 2018
13:35:00 +0300:

> The platform_get_resource() function doesn't return error pointers, it
> returns NULL on error.
> 
> Fixes: 3d4e51844a4e ("thermal: armada: convert driver to syscon register accesses")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index 2c2f6d93034e..92f67d40f2e9 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 -EIO;
>  
>  	/*
>  	 * Edit the resource start address and length to map over all the

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

Thanks,
Miquèl
diff mbox series

Patch

diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index 2c2f6d93034e..92f67d40f2e9 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 -EIO;
 
 	/*
 	 * Edit the resource start address and length to map over all the