aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/light/tcs3472.c
diff options
context:
space:
mode:
authorfrank zago <frank@zago.net>2021-04-26 21:20:17 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-14 16:55:44 +0200
commit17c67f484893050235adf473aadad3e9c0648bbb (patch)
tree3925f8d749d3bdfbd648bc2ae4c5ac6a002d436c /drivers/iio/light/tcs3472.c
parent6534a5e0c28c6c34db9335d5d2400f3a877ef7b4 (diff)
downloadkernel_replicant_linux-17c67f484893050235adf473aadad3e9c0648bbb.tar.gz
kernel_replicant_linux-17c67f484893050235adf473aadad3e9c0648bbb.tar.bz2
kernel_replicant_linux-17c67f484893050235adf473aadad3e9c0648bbb.zip
iio: light: tcs3472: do not free unallocated IRQ
commit 7cd04c863f9e1655d607705455e7714f24451984 upstream. Allocating an IRQ is conditional to the IRQ existence, but freeing it was not. If no IRQ was allocate, the driver would still try to free IRQ 0. Add the missing checks. This fixes the following trace when the driver is removed: [ 100.667788] Trying to free already-free IRQ 0 [ 100.667793] WARNING: CPU: 0 PID: 2315 at kernel/irq/manage.c:1826 free_irq+0x1fd/0x370 ... [ 100.667914] Call Trace: [ 100.667920] tcs3472_remove+0x3a/0x90 [tcs3472] [ 100.667927] i2c_device_remove+0x2b/0xa0 Signed-off-by: frank zago <frank@zago.net> Link: https://lore.kernel.org/r/20210427022017.19314-2-frank@zago.net Fixes: 9d2f715d592e ("iio: light: tcs3472: support out-of-threshold events") Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/light/tcs3472.c')
-rw-r--r--drivers/iio/light/tcs3472.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/iio/light/tcs3472.c b/drivers/iio/light/tcs3472.c
index a0dc447aeb68..b41068492338 100644
--- a/drivers/iio/light/tcs3472.c
+++ b/drivers/iio/light/tcs3472.c
@@ -531,7 +531,8 @@ static int tcs3472_probe(struct i2c_client *client,
return 0;
free_irq:
- free_irq(client->irq, indio_dev);
+ if (client->irq)
+ free_irq(client->irq, indio_dev);
buffer_cleanup:
iio_triggered_buffer_cleanup(indio_dev);
return ret;
@@ -559,7 +560,8 @@ static int tcs3472_remove(struct i2c_client *client)
struct iio_dev *indio_dev = i2c_get_clientdata(client);
iio_device_unregister(indio_dev);
- free_irq(client->irq, indio_dev);
+ if (client->irq)
+ free_irq(client->irq, indio_dev);
iio_triggered_buffer_cleanup(indio_dev);
tcs3472_powerdown(iio_priv(indio_dev));