iio: chemical: atlas-sensor: fix PM reference leak in buffer postenable

atlas_buffer_postenable() acquires a runtime PM reference with
pm_runtime_resume_and_get() but returns the result of
atlas_set_interrupt() directly. If atlas_set_interrupt() fails,
the runtime PM reference is leaked and the device can never
autosuspend.

Add pm_runtime_put_autosuspend() on the error path to balance
the reference.

Fixes: 0e4f336f50 ("iio: chemical: atlas-sensor: Balance runtime pm + pm_runtime_resume_and_get()")
Cc: stable@vger.kernel.org
Signed-off-by: Moksh Panicker <mokshpanicker.7@gmail.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
Moksh Panicker 2026-07-13 03:00:46 +00:00 committed by Jonathan Cameron
parent a3c03cf36a
commit bcd3f72e26

View File

@ -413,7 +413,11 @@ static int atlas_buffer_postenable(struct iio_dev *indio_dev)
if (ret)
return ret;
return atlas_set_interrupt(data, true);
ret = atlas_set_interrupt(data, true);
if (ret)
pm_runtime_put_autosuspend(&data->client->dev);
return ret;
}
static int atlas_buffer_predisable(struct iio_dev *indio_dev)