Skip to content

Commit 7a43ccf

Browse files
andy-shevlag-linaro
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent b6de441 commit 7a43ccf

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/leds/led-class.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ EXPORT_SYMBOL_GPL(led_add_lookup);
421421
*/
422422
void led_remove_lookup(struct led_lookup_data *led_lookup)
423423
{
424+
if (!led_lookup)
425+
return;
426+
424427
mutex_lock(&leds_lookup_lock);
425428
list_del(&led_lookup->list);
426429
mutex_unlock(&leds_lookup_lock);

0 commit comments

Comments
 (0)