From: Daniel Mack <daniel@zonque.org>
To: Matt Ranostay <mranostay@gmail.com>,
Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Daniel Mack <zonque@gmail.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
linux-leds@vger.kernel.org,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH v3 2/2] cap11xx: add LED support
Date: Mon, 15 Jun 2015 11:03:09 +0200 [thread overview]
Message-ID: <557E94CD.30705@zonque.org> (raw)
In-Reply-To: <CAKzfze8E-22XxzGuMUJWhcpmdoA=63XWR-v+bpf+Cdn70VoJqA@mail.gmail.com>
On 06/15/2015 10:56 AM, Matt Ranostay wrote:
> On Mon, Jun 15, 2015 at 1:15 AM, Jacek Anaszewski
> <j.anaszewski@samsung.com> 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.
Daniel
next prev parent reply other threads:[~2015-06-15 9:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-13 4:17 [PATCH v3 0/2] cap11xx: Add LED support to driver Matt Ranostay
2015-06-13 4:17 ` [PATCH v3 1/2] dt: add cap11xx LED documentation Matt Ranostay
2015-06-15 8:15 ` Jacek Anaszewski
[not found] ` <557E8990.5060702-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-06-15 8:48 ` Matt Ranostay
2015-06-15 10:10 ` Jacek Anaszewski
2015-06-15 17:00 ` Matt Ranostay
2015-06-13 4:17 ` [PATCH v3 2/2] cap11xx: add LED support Matt Ranostay
2015-06-15 8:15 ` Jacek Anaszewski
2015-06-15 8:56 ` Matt Ranostay
2015-06-15 9:03 ` Daniel Mack [this message]
2015-06-15 17:01 ` Matt Ranostay
2015-06-15 10:11 ` Jacek Anaszewski
2015-06-15 17:02 ` Matt Ranostay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=557E94CD.30705@zonque.org \
--to=daniel@zonque.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=j.anaszewski@samsung.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=mranostay@gmail.com \
--cc=zonque@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.