Message ID | 20150722214739.GA15790@amd (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, 22 Jul 2015, Pavel Machek wrote: > > I am however not sure whether input_leds_connect() is not too unkind to > > unnamed LEDs and shouldn't be more tolerant to those in the long term. > > Maybe. > > > From: Jiri Kosina <jkosina@suse.com> > > Subject: [PATCH] Input: leds: don't attempt to deregister unnamed LEDs > > > > input_leds_connect() is skipping registration of LEDs for which > > there is no symbolic name in input_led_info[]. > > Yes, and rather than testing for "no name" special case at two places, > what about simply giving up when we see such error? Well, that's quite the oposite of the "be more tolerant" aproach proposed above :) I don't see a reason why the sole fact that the device has at least one LED that kernel can't handle properly should mean that neither of the other LEDs will work.
diff --git a/drivers/input/input-leds.c b/drivers/input/input-leds.c index 074a65e..5f300e6 100644 --- a/drivers/input/input-leds.c +++ b/drivers/input/input-leds.c @@ -112,7 +112,11 @@ static int input_leds_connect(struct input_handler *handler, led->handle = &leds->handle; led->code = led_code; - if (WARN_ON(!input_led_info[led_code].name)) + if (!input_led_info[led_code].name) { + printk(KERN_ERR, "LED with no name\n"); + error = -EINVAL; + goto err_unregister_leds; + } continue; led->cdev.name = kasprintf(GFP_KERNEL, "%s::%s",