hwmon: (it87) Simplify error return in it87_device_add
authorGuenter Roeck <linux@roeck-us.net>
Sat, 28 Mar 2015 14:44:59 +0000 (07:44 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 19 Apr 2016 13:32:35 +0000 (06:32 -0700)
Return directly on errors if there is no cleanup necessary.
Don't create an error message on memory allocation errors.

Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/it87.c

index 68c8d98e711ac28cae49f5aecc2d05e28d8ad7b5..9b36987d7949ec4298ad41bc4710c04364623d99 100644 (file)
@@ -2898,14 +2898,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) {
@@ -2930,7 +2927,6 @@ static int __init it87_device_add(unsigned short address,
 
 exit_device_put:
        platform_device_put(pdev);
-exit:
        return err;
 }