leds: class: Make led_remove_lookup() NULL-aware
PATCH 1/1 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]>
--- drivers/leds/led-class.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/leds/led-class.c +3 -0
@@ -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);
Signature · 1 line
2.50.1
Re: (subset) [PATCH v1 1/1] leds: class: Make led_remove_lookup() NULL-aware
Quoted 3 lines · Andy Shevchenko
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.
Applied, thanks!
[1/1] leds: class: Make led_remove_lookup() NULL-aware
commit: 7a43ccf85dfe06eef483c034e68b81ff326741aa
--
Lee Jones [李琼斯]