io: pressure: zpa2326: handle pm_runtime_get_sync failure
PATCH 1/1 io: 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.
--- drivers/iio/pressure/zpa2326.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/pressure/zpa2326.c +3 -1
@@ -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 ) {/*
Signature · 1 line
2.17.1
Jonathan Cameron
maintainerQuoted 5 lines · On Thu, 4 Jun 2020 21:44:44 -0500 Navid Emamdoost <[email protected]>…
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>
Hi Navid,
This looks to be a fix, be it for a case that we are hopefully unlikely to ever hit. Please could you add an appropriate Fixes tag so we can work out how far to backport it?
Patch looks good to me so if you just reply with a suitable tag I can add it whilst applying.
Thanks,
Jonathan
Quoted 20 lines
--- drivers/iio/pressure/zpa2326.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/iio/pressure/zpa2326.c +3
-1@@ -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 ) {/*
A message that is not in the archive (sent off-list or not yet received): CAHp75VeRaS0JBRSyr+MeCbkVsscLyxkag00eY+pMPXZ6Jvb2zQ@mail.gmail.com
Quoted 14 lines · Andy Shevchenko
Quoted 10 lines · Jonathan Cameron
Quoted 5 lines · On Thu, 4 Jun 2020 21:44:44 -0500 Navid Emamdoost <[email protected]>…
Calling
pm_runtime_get_syncincrements the counter even in case of failure, causing incorrect ref count. Callpm_runtime_putifpm_runtime_get_syncfails.Signed-off-by Navid Emamdoost <[email protected]>
Quoted 8 lines
Quoted 8 lines
Hi Navid,
This looks to be a fix, be it for a case that we are hopefully unlikely to ever hit. Please could you add an appropriate Fixes tag so we can work out how far to backport it?
Patch looks good to me so if you just reply with a suitable tag I can add it whilst applying.
Hi Jonathan,
Here is the fixes tag:
Quoted 4 lines
Should not be "iio: ..." in the prefix?
Yes! It should be "iio" in the patch name.
Quoted 34 lines
Quoted 24 lines
Thanks,
Jonathan
Quoted 18 lines
--- drivers/iio/pressure/zpa2326.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/iio/pressure/zpa2326.c +3
-1@@ -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; + }Quoted 3 lines
drivers/iio/pressure/zpa2326.c static int zpa2326_resume(const struct iio_dev *indio_dev) · line 673
Quoted 2 lines
drivers/iio/pressure/zpa2326.c +0
-0if (err >0 ) {/* --
With Best Regards,
Andy Shevchenko
Signature · 1 line
Navid.