[PATCH 23/28] iio: pressure: zpa2326: fix potential extra call of runtime suspend.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>

This case illustrates why the new pm_runtime_sync_and_get() is good
in that it makes clear the correct way to handle errors.

Calling pm_runtime_put() on failure of the _get() in pm_runtime_get_sync()
will potentially result in powering down an already powered down device
(as we never successfully powered it up.  Unlikely to cause any problems
in reality.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
---
 drivers/iio/pressure/zpa2326.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/pressure/zpa2326.c b/drivers/iio/pressure/zpa2326.c
index 89295c90f801..97ac3ba399f7 100644
--- a/drivers/iio/pressure/zpa2326.c
+++ b/drivers/iio/pressure/zpa2326.c
@@ -664,11 +664,9 @@ static int zpa2326_resume(const struct iio_dev *indio_dev)
 {
 	int err;
 
-	err = pm_runtime_get_sync(indio_dev->dev.parent);
-	if (err < 0) {
-		pm_runtime_put(indio_dev->dev.parent);
+	err = pm_runtime_resume_and_get(indio_dev->dev.parent);
+	if (err < 0)
 		return err;
-	}
 
 	if (err > 0) {
 		/*
-- 
2.31.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux