From d46a76405fad48a7efc3faf07545fa886a3b271a Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 17 Sep 2014 00:13:55 +0300 Subject: intel-rst: Use ACPI_FAILURE() macro instead !ACPI_SUCCESS() for error checking ACPI_SUCCESS is defined as: #define ACPI_SUCCESS(a) (!(a)) There is no need for the the double ! since there is already a macro defined for failures: ACPI_FAILURE() Signed-off-by: Peter Ujfalusi Signed-off-by: Darren Hart --- drivers/platform/x86/intel-rst.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/platform/x86/intel-rst.c') diff --git a/drivers/platform/x86/intel-rst.c b/drivers/platform/x86/intel-rst.c index d45bca34bf1..8c6a8fed8a0 100644 --- a/drivers/platform/x86/intel-rst.c +++ b/drivers/platform/x86/intel-rst.c @@ -35,7 +35,7 @@ static ssize_t irst_show_wakeup_events(struct device *dev, acpi = to_acpi_device(dev); status = acpi_evaluate_integer(acpi->handle, "GFFS", NULL, &value); - if (!ACPI_SUCCESS(status)) + if (ACPI_FAILURE(status)) return -EINVAL; return sprintf(buf, "%lld\n", value); @@ -59,7 +59,7 @@ static ssize_t irst_store_wakeup_events(struct device *dev, status = acpi_execute_simple_method(acpi->handle, "SFFS", value); - if (!ACPI_SUCCESS(status)) + if (ACPI_FAILURE(status)) return -EINVAL; return count; @@ -81,7 +81,7 @@ static ssize_t irst_show_wakeup_time(struct device *dev, acpi = to_acpi_device(dev); status = acpi_evaluate_integer(acpi->handle, "GFTV", NULL, &value); - if (!ACPI_SUCCESS(status)) + if (ACPI_FAILURE(status)) return -EINVAL; return sprintf(buf, "%lld\n", value); @@ -105,7 +105,7 @@ static ssize_t irst_store_wakeup_time(struct device *dev, status = acpi_execute_simple_method(acpi->handle, "SFTV", value); - if (!ACPI_SUCCESS(status)) + if (ACPI_FAILURE(status)) return -EINVAL; return count; -- cgit v1.2.3-70-g09d2 From a3d3c53f738bb931e15b20d3dc5d23722b9ede6a Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 17 Sep 2014 00:13:56 +0300 Subject: 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 Signed-off-by: Darren Hart --- drivers/platform/x86/intel-rst.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'drivers/platform/x86/intel-rst.c') diff --git a/drivers/platform/x86/intel-rst.c b/drivers/platform/x86/intel-rst.c index 8c6a8fed8a0..7344d841f4d 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; } -- cgit v1.2.3-70-g09d2