Skip to contentSkip to conversation

thermal: armada: NULL vs IS_ERR() bug in probe

PATCH In review Dan Carpenter 2 participants 3 messages Sep 26, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: armada: NULL vs IS_ERR() bug in probe

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")
drivers/thermal/armada_thermal.c +2 -2
index 2c2f6d93034e..ebfe7c9a5a7a 100644
@@ -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 -ENODEV;
 
 	/*
 	 * Edit the resource start address and length to map over all the
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi Dan,

Dan Carpenter <[email protected]> wrote on Wed, 26 Sep 2018 13:43:36 +0300:

Quoted 11 lines

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")
drivers/thermal/armada_thermal.c +0 -0
index 2c2f6d93034e..ebfe7c9a5a7a 100644

drivers/thermal/armada_thermal.c static int armada_thermal_probe_legacy(struct platform_device *pdev, · line 533

Quoted 10 lines
drivers/thermal/armada_thermal.c +2 -2
@@ -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 -ENODEV;
 
 	/*
 	 * Edit the resource start address and length to map over all the

I already sent my

for this patch, and it looks like the title changed so it's a v2, right?

Regards,
Miquèl

#2 lore raw
In reply to Dan Carpenter
Quoted 30 lines · Miquel Raynal

Hi Dan,

Dan Carpenter <[email protected]> wrote on Wed, 26 Sep 2018 13:43:36 +0300:

Quoted 11 lines

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")
drivers/thermal/armada_thermal.c +0 -0
index 2c2f6d93034e..ebfe7c9a5a7a 100644

drivers/thermal/armada_thermal.c static int armada_thermal_probe_legacy(struct platform_device *pdev, · line 533

Quoted 10 lines
drivers/thermal/armada_thermal.c +2 -2
@@ -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 -ENODEV;
 
 	/*
 	 * Edit the resource start address and length to map over all the

I already sent my

Quoted 3 lines

for this patch, and it looks like the title changed so it's a v2, right?

Ooops. I'm sorry, I switched dev boxes and so I accidentally re-wrote this patch. My bad. Sorry for the noise.

regards,
dan carpenter