devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Cc: Oleksandr Kravchenko <x0199363@ti.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, grant.likely@linaro.org,
	rob.herring@calxeda.com, rob@landley.net, jic23@cam.ac.uk,
	pmeerw@pmeerw.net, holler@ahsoftware.de,
	srinivas.pandruvada@intel.com,
	devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH] iio: add APDS9300 ambilent light sensor driver
Date: Mon, 15 Jul 2013 14:35:23 +0200	[thread overview]
Message-ID: <51E3EC8B.3090601@metafoo.de> (raw)
In-Reply-To: <CAGH3drqEPxW=QwadCLj=ZOQe0gp_c7mdSiNQnq1_-BMKL9CgJw@mail.gmail.com>

On 07/15/2013 02:27 PM, Oleksandr Kravchenko wrote:
> Thank you for review! But I don't completely understand one of your comment:
> 
>>> +static int als_probe(struct i2c_client *client, const struct i2c_device_id *id)
> [...]
>>> +     if (client->irq) {
>>> +             ret = devm_request_threaded_irq(&client->dev, client->irq,
>>> +                             NULL, als_interrupt_handler,
>>> +                             IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
>>> +                             ALS_IRQ_NAME, indio_dev);
>>
>> This is a bit racy, you access memory in the irq handler that is freed
>> before the irq is freed.
> 
> Do you mean than that indio_dev may be used in interrupt handler after
> iio_device_free(indio_dev) called in als_remove() function?
> 
> If so, can I use disable_irq() in als_remove() before iio_device_free()
> to avoid this problem?
> 

Just add a devm_iio_device_alloc() and use that, instead of trying to bodch
around the issue.


  reply	other threads:[~2013-07-15 12:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10 13:08 [PATCH] iio: add APDS9300 ambilent light sensor driver Oleksandr Kravchenko
2013-07-12 17:04 ` Lars-Peter Clausen
2013-07-15 12:27   ` Oleksandr Kravchenko
2013-07-15 12:35     ` Lars-Peter Clausen [this message]
2013-07-15 14:54       ` Oleksandr Kravchenko
2013-07-15 15:54         ` Lars-Peter Clausen

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=51E3EC8B.3090601@metafoo.de \
    --to=lars@metafoo.de \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@linaro.org \
    --cc=holler@ahsoftware.de \
    --cc=jic23@cam.ac.uk \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o.v.kravchenko@globallogic.com \
    --cc=pmeerw@pmeerw.net \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=srinivas.pandruvada@intel.com \
    --cc=x0199363@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).