提交 a3d3c53f 编写于 作者: P Peter Ujfalusi 提交者: Darren Hart

intel-rst: Clean up ACPI add function

There is no need to initialize the error since it is going to be assigned
with the return status of at least on of the device_create_file() call.

We can return directly in case the first file creation fails.
All the labels for goto can be removed (along with the gotos) as well.
Tell the compiler that the failures are unlikely so it can create better
binaries.
Signed-off-by: NPeter Ujfalusi <peter.ujfalusi@gmail.com>
Signed-off-by: NDarren Hart <dvhart@linux.intel.com>
上级 d46a7640
无相关合并请求
...@@ -119,21 +119,16 @@ static struct device_attribute irst_timeout_attr = { ...@@ -119,21 +119,16 @@ static struct device_attribute irst_timeout_attr = {
static int irst_add(struct acpi_device *acpi) static int irst_add(struct acpi_device *acpi)
{ {
int error = 0; int error;
error = device_create_file(&acpi->dev, &irst_timeout_attr); error = device_create_file(&acpi->dev, &irst_timeout_attr);
if (error) if (unlikely(error))
goto out; return error;
error = device_create_file(&acpi->dev, &irst_wakeup_attr); error = device_create_file(&acpi->dev, &irst_wakeup_attr);
if (error) if (unlikely(error))
goto out_timeout; device_remove_file(&acpi->dev, &irst_timeout_attr);
return 0;
out_timeout:
device_remove_file(&acpi->dev, &irst_timeout_attr);
out:
return error; return error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部