瀏覽代碼

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.

Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Guenter Roeck 10 年之前
父節點
當前提交
5cae84a58e
共有 1 個文件被更改,包括 3 次插入7 次删除
  1. 3 7
      drivers/hwmon/it87.c

+ 3 - 7
drivers/hwmon/it87.c

@@ -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;
 }