Re: [PATCH v3 2/2] cap11xx: add LED support
From: Matt Ranostay <hidden>
Date: 2015-06-15 17:01:26
Also in:
linux-devicetree, linux-leds
From: Matt Ranostay <hidden>
Date: 2015-06-15 17:01:26
Also in:
linux-devicetree, linux-leds
On Mon, Jun 15, 2015 at 2:03 AM, Daniel Mack [off-list ref] wrote:
On 06/15/2015 10:56 AM, Matt Ranostay wrote:quoted
On Mon, Jun 15, 2015 at 1:15 AM, Jacek Anaszewski [off-list ref] wrote:quoted
quoted
quoted
+ error = devm_led_classdev_register(dev, &led->cdev); + if (error < 0) + return -EINVAL; + INIT_WORK(&led->work, cap11xx_led_work); + schedule_work(&led->work);Work queue should be initialized before registration of the LED class device.What is the reason for this? Just curiousIt's a race condition. The LED device is accessible once devm_led_classdev_register() returns. So a user could be calling into cap11xx_led_set() before the work queue is initialized, which would hence access a NULL pointer.
Ah thanks for explaining. Will fix in v4.
Daniel