提交 5cae84a5 编写于 作者: G Guenter Roeck

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: NMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
上级 60878bcf
...@@ -2898,14 +2898,11 @@ static int __init it87_device_add(unsigned short address, ...@@ -2898,14 +2898,11 @@ static int __init it87_device_add(unsigned short address,
err = acpi_check_resource_conflict(&res); err = acpi_check_resource_conflict(&res);
if (err) if (err)
goto exit; return err;
pdev = platform_device_alloc(DRVNAME, address); pdev = platform_device_alloc(DRVNAME, address);
if (!pdev) { if (!pdev)
err = -ENOMEM; return -ENOMEM;
pr_err("Device allocation failed\n");
goto exit;
}
err = platform_device_add_resources(pdev, &res, 1); err = platform_device_add_resources(pdev, &res, 1);
if (err) { if (err) {
...@@ -2930,7 +2927,6 @@ static int __init it87_device_add(unsigned short address, ...@@ -2930,7 +2927,6 @@ static int __init it87_device_add(unsigned short address,
exit_device_put: exit_device_put:
platform_device_put(pdev); platform_device_put(pdev);
exit:
return err; return err;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册