From 8d67160ea874a80c78193bf7b426f4caf69d8c07 Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Tue, 25 Oct 2022 14:06:38 +0200 Subject: [PATCH] Add missing error handling --- src/uniwill_leds.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/uniwill_leds.h b/src/uniwill_leds.h index 6d7c305..2d3b8af 100644 --- a/src/uniwill_leds.h +++ b/src/uniwill_leds.h @@ -217,12 +217,20 @@ int uniwill_leds_init_late(struct platform_device *dev) } EXPORT_SYMBOL(uniwill_leds_init_late); -int uniwill_leds_remove(struct platform_device *dev) { +int uniwill_leds_remove(struct platform_device *dev) +{ // FIXME Use mutexes + int ret; + if (uw_leds_initialized) { uw_leds_initialized = false; + uniwill_leds_set_brightness_extern(0x00); ret = uniwill_write_ec_ram(UW_EC_REG_KBD_BL_MAX_BRIGHTNESS, 0xc8); + if (ret) { + pr_err("Resetting max keyboard brightness value failed\n"); + } + if (uniwill_kb_backlight_type == UNIWILL_KB_BACKLIGHT_TYPE_FIXED_COLOR) { led_classdev_unregister(&uniwill_led_cdev); } @@ -231,7 +239,7 @@ int uniwill_leds_remove(struct platform_device *dev) { } } - return 0; + return ret; } EXPORT_SYMBOL(uniwill_leds_remove);