summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2020-06-05 04:44:44 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-06-14 16:25:04 +0200
commitd88de040e1df38414fc1e4380be9d0e997ab4d58 (patch)
treeab9ffd6f27bc73d4c42b144fc347fb5b5d99833b /drivers/iio
parentcounter: 104-quad-8: Add lock guards - filter clock prescaler (diff)
downloadlinux-d88de040e1df38414fc1e4380be9d0e997ab4d58.tar.xz
linux-d88de040e1df38414fc1e4380be9d0e997ab4d58.zip
iio: pressure: zpa2326: handle pm_runtime_get_sync failure
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: 03b262f2bbf4 ("iio:pressure: initial zpa2326 barometer support") Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/pressure/zpa2326.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c
index 37fe851f89af..799a8dc3e248 100644
--- a/drivers/iio/pressure/zpa2326.c
+++ b/drivers/iio/pressure/zpa2326.c
@@ -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) {
/*