Re: [PATCH v3 2/2] cap11xx: add LED support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, Jun 15, 2015 at 2:03 AM, Daniel Mack <daniel@xxxxxxxxxx> wrote:
> On 06/15/2015 10:56 AM, Matt Ranostay wrote:
>> On Mon, Jun 15, 2015 at 1:15 AM, Jacek Anaszewski
>> <j.anaszewski@xxxxxxxxxxx> wrote:
>
>>>> +               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 curious
>
> It'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
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux