1
0
Fork 0

iio: pressure: zpa2326: handle pm_runtime_get_sync failure

commit d88de040e1 upstream.

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: 03b262f2bb ("iio:pressure: initial zpa2326 barometer support")
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5.4-rM2-2.2.x-imx-squashed
Navid Emamdoost 2020-06-04 21:44:44 -05:00 committed by Greg Kroah-Hartman
parent 4ecff6ee26
commit 74953efffb
1 changed files with 3 additions and 1 deletions

View File

@ -664,8 +664,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) {
/*