On Fri, Aug 16, 2019 at 01:49:08PM +0200, Pavel Machek wrote: > Hi! > > > If in the certain driver the LED is optional, and it's a majority of them, > > the call of led_classdev_unregister() still requires some additional checks. > > > > The usual pattern on unregistering is to check for NULL, but we also check > > for IS_ERR() in case device_create_with_groups() fails. > > > > The change will reduce a burden in a lot of drivers to repeatedly check > > for above conditions. > > I don't see majority of calls being protected. Doing nothing on NULL > sounds reasonable. I'm less sure about "IS_ERR"... Majority by drivers, not by absolute number of calls you can grep for. What I'm referring to is, for example, commit 99fef587ff98894426d9bf1f5b7336345052d4b3 Author: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Date: Mon Dec 3 20:21:41 2018 +0200 driver core: platform: Respect return code of platform_device_register_full() -- With Best Regards, Andy Shevchenko