summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@gmail.com>2014-09-16 21:13:56 (GMT)
committerDarren Hart <dvhart@linux.intel.com>2014-09-17 20:55:54 (GMT)
commita3d3c53f738bb931e15b20d3dc5d23722b9ede6a (patch)
treea22ba87043bfc58a76a8cba15d5c4893c1d952f6 /drivers/platform
parentd46a76405fad48a7efc3faf07545fa886a3b271a (diff)
downloadlinux-a3d3c53f738bb931e15b20d3dc5d23722b9ede6a.tar.xz
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: Peter Ujfalusi <peter.ujfalusi@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/intel-rst.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/platform/x86/intel-rst.c b/drivers/platform/x86/intel-rst.c
index 8c6a8fe..7344d84 100644
--- a/drivers/platform/x86/intel-rst.c
+++ b/drivers/platform/x86/intel-rst.c
@@ -119,21 +119,16 @@ static struct device_attribute irst_timeout_attr = {
static int irst_add(struct acpi_device *acpi)
{
- int error = 0;
+ int error;
error = device_create_file(&acpi->dev, &irst_timeout_attr);
- if (error)
- goto out;
+ if (unlikely(error))
+ return error;
error = device_create_file(&acpi->dev, &irst_wakeup_attr);
- if (error)
- goto out_timeout;
+ if (unlikely(error))
+ device_remove_file(&acpi->dev, &irst_timeout_attr);
- return 0;
-
-out_timeout:
- device_remove_file(&acpi->dev, &irst_timeout_attr);
-out:
return error;
}