Skip to contentSkip to conversation

thermal: spear13xx: checking for NULL instead of IS_ERR()

PATCH In review Dan Carpenter 3 participants 3 messages Feb 29, 2012

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

PATCH 1/1 thermal: spear13xx: checking for NULL instead of IS_ERR()

thermal_zone_device_register() never returns NULL, on error it returns and ERR_PTR().

drivers/thermal/spear_thermal.c +2 -2
index 880bf28..7352cf8 100644
@@ -149,9 +149,9 @@ static int spear_thermal_probe(struct platform_device *pdev)
 
 	spear_thermal = thermal_zone_device_register("spear_thermal", 0,
 				stdev, &ops, 0, 0, 0, 0);
-	if (!spear_thermal) {
+	if (IS_ERR(spear_thermal)) {
 		dev_err(&pdev->dev, "thermal zone device is NULL\n");
-		ret = -EINVAL;
+		ret = PTR_ERR(spear_thermal);
 		goto disable_clk;
 	}
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Dan Carpenter

thermal_zone_device_register() never returns NULL, on error it returns and ERR_PTR().

drivers/thermal/spear_thermal.c +0 -0
index 880bf28..7352cf8 100644
@@ -149,9 +149,9 @@ static int spear_thermal_probe(struct platform_device *pdev)
 

drivers/thermal/spear_thermal.c static int spear_thermal_probe(struct platform_device *pdev) · line 157

Quoted 10 lines
drivers/thermal/spear_thermal.c +2 -2
 	spear_thermal = thermal_zone_device_register("spear_thermal", 0,
 				stdev, &ops, 0, 0, 0, 0);
-	if (!spear_thermal) {
+	if (IS_ERR(spear_thermal)) {
 		dev_err(&pdev->dev, "thermal zone device is NULL\n");
-		ret = -EINVAL;
+		ret = PTR_ERR(spear_thermal);
 		goto disable_clk;
 	}
 

Thanks.

Signature · 1 line
viresh
Reviewed-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter

Thanks Dan.

Il 29/02/2012 07:31, Dan Carpenter ha scritto:

Quoted 11 lines

thermal_zone_device_register() never returns NULL, on error it returns and ERR_PTR().

drivers/thermal/spear_thermal.c +0 -0
index 880bf28..7352cf8 100644
@@ -149,9 +149,9 @@ static int spear_thermal_probe(struct platform_device *pdev)
 

drivers/thermal/spear_thermal.c static int spear_thermal_probe(struct platform_device *pdev) · line 157

Quoted 10 lines
drivers/thermal/spear_thermal.c +2 -2
 	spear_thermal = thermal_zone_device_register("spear_thermal", 0,
 				stdev, &ops, 0, 0, 0, 0);
-	if (!spear_thermal) {
+	if (IS_ERR(spear_thermal)) {
 		dev_err(&pdev->dev, "thermal zone device is NULL\n");
-		ret = -EINVAL;
+		ret = PTR_ERR(spear_thermal);
 		goto disable_clk;
 	}