mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
iio: accel: kxsd9: fix runtime PM imbalance on write_raw() error
kxsd9_write_raw() takes a runtime PM reference with pm_runtime_get_sync()
but returns -EINVAL directly when a scale with a non-zero integer part is
requested, skipping the matching pm_runtime_put_autosuspend(). This leaks
a runtime PM usage-counter reference on every such write, after which the
device can no longer autosuspend.
Set the error code and fall through to the existing put instead of
returning early.
Fixes: 9a9a369d61 ("iio: accel: kxsd9: Deploy system and runtime PM")
Signed-off-by: Biren Pandya <birenpandya@gmail.com>
Assisted-by: Claude:claude-opus-4-8 coccinelle
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
ce0e1cae26
commit
44a5fd874b
|
|
@ -147,8 +147,9 @@ static int kxsd9_write_raw(struct iio_dev *indio_dev,
|
|||
if (mask == IIO_CHAN_INFO_SCALE) {
|
||||
/* Check no integer component */
|
||||
if (val)
|
||||
return -EINVAL;
|
||||
ret = kxsd9_write_scale(indio_dev, val2);
|
||||
ret = -EINVAL;
|
||||
else
|
||||
ret = kxsd9_write_scale(indio_dev, val2);
|
||||
}
|
||||
|
||||
pm_runtime_put_autosuspend(st->dev);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user