Skip to contentSkip to conversation

hwmon: (it87) Simplify error return in it87_device_add

PATCH In review Guenter Roeck 1 participant 1 message Mar 30, 2015

Subsystems (2)
lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 11/15 hwmon: (it87) Simplify error return in it87_device_add

Return directly on errors if there is no cleanup necessary. Don't create an error message on memory allocation errors.

---
 drivers/hwmon/it87.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/hwmon/it87.c +3 -7
index b373589c695f..03900d4e71d1 100644
@@ -2869,14 +2869,11 @@ static int __init it87_device_add(unsigned short address,
 
 	err = acpi_check_resource_conflict(&res);
 	if (err)
-		goto exit;
+		return err;
 
 	pdev = platform_device_alloc(DRVNAME, address);
-	if (!pdev) {
-		err = -ENOMEM;
-		pr_err("Device allocation failed\n");
-		goto exit;
-	}
+	if (!pdev)
+		return -ENOMEM;
 
 	err = platform_device_add_resources(pdev, &res, 1);
 	if (err) {
@@ -2901,7 +2898,6 @@ static int __init it87_device_add(unsigned short address,
 
 exit_device_put:
 	platform_device_put(pdev);
-exit:
 	return err;
 }
 
Signature · 7 lines
2.1.0


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors