From: Navid Emamdoost Date: Fri, 5 Jun 2020 02:44:44 +0000 (-0500) Subject: iio: pressure: zpa2326: handle pm_runtime_get_sync failure X-Git-Tag: v4.14.189~60 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7fd2f25df59c862a3a116003a63e0ac2cb45c5d6;p=users%2Fdwmw2%2Flinux.git iio: pressure: zpa2326: handle pm_runtime_get_sync failure commit d88de040e1df38414fc1e4380be9d0e997ab4d58 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 Fixes: 03b262f2bbf4 ("iio:pressure: initial zpa2326 barometer support") Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c index 91431454eb85d..7ffc4a6d80cd5 100644 --- a/drivers/iio/pressure/zpa2326.c +++ b/drivers/iio/pressure/zpa2326.c @@ -672,8 +672,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) { /*