Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: gyro: mpu3050: Fix irq resource leak

The interrupt handler is setup but only a few lines down if
iio_trigger_register() fails the function returns without properly
releasing the handler.

Add cleanup goto to resolve resource leak.

Detected by Smatch:
drivers/iio/gyro/mpu3050-core.c:1128 mpu3050_trigger_probe() warn:
'irq' from request_threaded_irq() not released on lines: 1124.

Fixes: 3904b28efb2c7 ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Ethan Tidmore and committed by
Jonathan Cameron
4216db10 edb11a1a

+6 -1
+6 -1
drivers/iio/gyro/mpu3050-core.c
··· 1129 1129 1130 1130 ret = iio_trigger_register(mpu3050->trig); 1131 1131 if (ret) 1132 - return ret; 1132 + goto err_iio_trigger; 1133 1133 1134 1134 indio_dev->trig = iio_trigger_get(mpu3050->trig); 1135 1135 1136 1136 return 0; 1137 + 1138 + err_iio_trigger: 1139 + free_irq(mpu3050->irq, mpu3050->trig); 1140 + 1141 + return ret; 1137 1142 } 1138 1143 1139 1144 int mpu3050_common_probe(struct device *dev,