Commit 7a43ccf8 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Lee Jones
Browse files

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260327102729.797254-1-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarLee Jones <lee@kernel.org>
parent b6de441f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);