Skip to content

Commit

Permalink
iio: pressure: zpa2326: handle pm_runtime_get_sync failure
Browse files Browse the repository at this point in the history
Calling pm_runtime_get_sync increments the counter even in case of
failure, causing incorrect ref count. Call pm_runtime_put if
pm_runtime_get_sync fails.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Fixes: 03b262f ("iio:pressure: initial zpa2326 barometer support")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
Navidem authored and jic23 committed Jun 14, 2020
1 parent d5ed76a commit d88de04
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/iio/pressure/zpa2326.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,10 @@ static int zpa2326_resume(const struct iio_dev *indio_dev)
int err;

err = pm_runtime_get_sync(indio_dev->dev.parent);
if (err < 0)
if (err < 0) {
pm_runtime_put(indio_dev->dev.parent);
return err;
}

if (err > 0) {
/*
Expand Down

0 comments on commit d88de04

Please sign in to comment.