Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260327102729.797254-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Andy Shevchenko and committed by
Lee Jones
7a43ccf8 b6de441f

+3
+3
drivers/leds/led-class.c
··· 421 421 */ 422 422 void led_remove_lookup(struct led_lookup_data *led_lookup) 423 423 { 424 + if (!led_lookup) 425 + return; 426 + 424 427 mutex_lock(&leds_lookup_lock); 425 428 list_del(&led_lookup->list); 426 429 mutex_unlock(&leds_lookup_lock);