Skip to content

Commit

Permalink
platform/x86: fujitsu-laptop: simplify acpi_bus_register_driver() err…
Browse files Browse the repository at this point in the history
…or handling

A separate variable is not needed to handle error codes returned by
acpi_bus_register_driver().  If the latter fails, just use the value it
returned as the value returned by fujitsu_init().

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
[kempniu: rebase patch, rewrite commit message]
Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jonathan Woithe <jwoithe@just42.net>
  • Loading branch information
Alan Jenkins authored and Andy Shevchenko committed Feb 26, 2017
1 parent 8c590e3 commit c1d1e8a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions drivers/platform/x86/fujitsu-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ MODULE_DEVICE_TABLE(acpi, fujitsu_ids);

static int __init fujitsu_init(void)
{
int ret, result, max_brightness;
int ret, max_brightness;

if (acpi_disabled)
return -ENODEV;
Expand All @@ -1207,11 +1207,9 @@ static int __init fujitsu_init(void)
fujitsu_bl->keycode5 = KEY_RFKILL;
dmi_check_system(fujitsu_dmi_table);

result = acpi_bus_register_driver(&acpi_fujitsu_bl_driver);
if (result < 0) {
ret = -ENODEV;
ret = acpi_bus_register_driver(&acpi_fujitsu_bl_driver);
if (ret)
goto fail_acpi;
}

/* Register platform stuff */

Expand Down Expand Up @@ -1264,11 +1262,9 @@ static int __init fujitsu_init(void)
goto fail_laptop;
}

result = acpi_bus_register_driver(&acpi_fujitsu_laptop_driver);
if (result < 0) {
ret = -ENODEV;
ret = acpi_bus_register_driver(&acpi_fujitsu_laptop_driver);
if (ret)
goto fail_laptop1;
}

/* Sync backlight power status (needs FUJ02E3 device, hence deferred) */
if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
Expand Down

0 comments on commit c1d1e8a

Please sign in to comment.