diff options
author | Peter Ujfalusi <peter.ujfalusi@gmail.com> | 2014-09-16 17:13:56 -0400 |
---|---|---|
committer | Darren Hart <dvhart@linux.intel.com> | 2014-09-17 16:55:54 -0400 |
commit | a3d3c53f738bb931e15b20d3dc5d23722b9ede6a (patch) | |
tree | a22ba87043bfc58a76a8cba15d5c4893c1d952f6 /drivers/platform/x86 | |
parent | d46a76405fad48a7efc3faf07545fa886a3b271a (diff) |
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/x86')
-rw-r--r-- | drivers/platform/x86/intel-rst.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/platform/x86/intel-rst.c b/drivers/platform/x86/intel-rst.c index 8c6a8fed8a08..7344d841f4d9 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 = { | |||
119 | 119 | ||
120 | static int irst_add(struct acpi_device *acpi) | 120 | static int irst_add(struct acpi_device *acpi) |
121 | { | 121 | { |
122 | int error = 0; | 122 | int error; |
123 | 123 | ||
124 | error = device_create_file(&acpi->dev, &irst_timeout_attr); | 124 | error = device_create_file(&acpi->dev, &irst_timeout_attr); |
125 | if (error) | 125 | if (unlikely(error)) |
126 | goto out; | 126 | return error; |
127 | 127 | ||
128 | error = device_create_file(&acpi->dev, &irst_wakeup_attr); | 128 | error = device_create_file(&acpi->dev, &irst_wakeup_attr); |
129 | if (error) | 129 | if (unlikely(error)) |
130 | goto out_timeout; | 130 | device_remove_file(&acpi->dev, &irst_timeout_attr); |
131 | 131 | ||
132 | return 0; | ||
133 | |||
134 | out_timeout: | ||
135 | device_remove_file(&acpi->dev, &irst_timeout_attr); | ||
136 | out: | ||
137 | return error; | 132 | return error; |
138 | } | 133 | } |
139 | 134 | ||