From: Andy Shevchenko Date: Fri, 27 Mar 2026 10:27:29 +0000 (+0100) Subject: leds: class: Make led_remove_lookup() NULL-aware X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=7a43ccf85dfe06eef483c034e68b81ff326741aa;p=thirdparty%2Flinux.git leds: class: Make led_remove_lookup() NULL-aware It is a usual pattern in the kernel to make releasing functions be NULL-aware so they become a no-op. This helps reducing unneeded checks in the code where the given resource is optional. Signed-off-by: Andy Shevchenko Link: https://patch.msgid.link/20260327102729.797254-1-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones --- diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 8d7ec9ccb173..9e14ae588f78 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -421,6 +421,9 @@ EXPORT_SYMBOL_GPL(led_add_lookup); */ void led_remove_lookup(struct led_lookup_data *led_lookup) { + if (!led_lookup) + return; + mutex_lock(&leds_lookup_lock); list_del(&led_lookup->list); mutex_unlock(&leds_lookup_lock);