ACPI: battery: Drop redundant test for failure
authorBjørn Mork <bjorn@mork.no>
Tue, 5 Dec 2017 17:46:39 +0000 (18:46 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 13 Dec 2017 00:14:54 +0000 (01:14 +0100)
Merging the two adjacent conditionally built blocks makes the code
a lot more readable.  And as a bonus, we drop a duplicate test when
CONFIG_ACPI_PROCFS_POWER is undefined.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/battery.c

index 13e7b56e33aebbc7965bc89d53086c42df179c31..f2eb6c37ea0aa9aed03f562883634add68078f55 100644 (file)
@@ -1237,13 +1237,11 @@ static int acpi_battery_add(struct acpi_device *device)
 
 #ifdef CONFIG_ACPI_PROCFS_POWER
        result = acpi_battery_add_fs(device);
-#endif
        if (result) {
-#ifdef CONFIG_ACPI_PROCFS_POWER
                acpi_battery_remove_fs(device);
-#endif
                goto fail;
        }
+#endif
 
        printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
                ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),