mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
iio: light: gp2ap002: fix runtime PM leak on read error
commit38b72267b7upstream. gp2ap002_read_raw() calls pm_runtime_get_sync() before reading the lux value, but if gp2ap002_get_lux() fails, it returns directly. This skips the pm_runtime_put_autosuspend() call at the "out" label, permanently leaking a runtime PM reference and preventing the device from autosuspending. Replace the direct return with a "goto out" to ensure the reference is properly dropped on the error path. Fixes:f6dbf83c17("iio: light: gp2ap002: Take runtime PM reference on light read") Signed-off-by: Biren Pandya <birenpandya@gmail.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a60bf629a7
commit
0c655d067a
@@ -258,7 +258,7 @@ static int gp2ap002_read_raw(struct iio_dev *indio_dev,
|
||||
case IIO_LIGHT:
|
||||
ret = gp2ap002_get_lux(gp2ap002);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto out;
|
||||
*val = ret;
|
||||
ret = IIO_VAL_INT;
|
||||
goto out;
|
||||
|
||||
Reference in New Issue
Block a user