[PATCH] iio: add APDS9300 ambilent light sensor driver
Lars-Peter Clausen
lars at metafoo.de
Mon Jul 15 22:35:23 EST 2013
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.
More information about the devicetree-discuss
mailing list