linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] spi: spi-ti-qspi: call pm_runtime_put on pm_runtime_get failure
@ 2020-06-02  8:40 Markus Elfring
  2020-06-02  9:49 ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Markus Elfring @ 2020-06-02  8:40 UTC (permalink / raw)
  To: Navid Emamdoost, linux-spi
  Cc: Navid Emamdoost, Kangjie Lu, Stephen McCamant, Qiushi Wu,
	Mark Brown, Dinghao Liu, LKML, kernel-janitors

> The counter is incremented via pm_runtime_get even in failure case.
> To correct the counter call pm_runtime_put in case of failure, too.

How do you think about a wording variant like the following?

   Change description:
   The PM runtime reference counter is generally incremented by a call of
   the function “pm_runtime_get_sync”.
   Thus call the function “pm_runtime_put_autosuspend” also in one error case
   to keep the reference counting consistent.


Would you like to add the tag “Fixes” to the commit message?

Regards,
Markus

^ permalink raw reply	[flat|nested] 10+ messages in thread
* [PATCH] spi: spi-ti-qspi: call pm_runtime_put on pm_runtime_get failure
@ 2020-06-02  4:36 Navid Emamdoost
  2020-06-02  9:54 ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Navid Emamdoost @ 2020-06-02  4:36 UTC (permalink / raw)
  To: Mark Brown, linux-spi, linux-kernel
  Cc: emamd001, wu000273, kjlu, smccaman, Navid Emamdoost

The counter is incremented via pm_runtime_get even in failure case.
To correct the counter call pm_runtime_put in case of failure, too.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/spi/spi-ti-qspi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 366a3e5cca6b..dfb811c5ef76 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -174,6 +174,7 @@ static int ti_qspi_setup(struct spi_device *spi)
 
 	ret = pm_runtime_get_sync(qspi->dev);
 	if (ret < 0) {
+		pm_runtime_put_autosuspend(qspi->dev);
 		dev_err(qspi->dev, "pm_runtime_get_sync() failed\n");
 		return ret;
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-06-02 19:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-02  8:40 [PATCH] spi: spi-ti-qspi: call pm_runtime_put on pm_runtime_get failure Markus Elfring
2020-06-02  9:49 ` Mark Brown
2020-06-02 10:02   ` Markus Elfring
2020-06-02 14:13     ` Mark Brown
2020-06-02 15:05       ` Markus Elfring
2020-06-02 18:36         ` Mark Brown
2020-06-02 19:35           ` Navid Emamdoost
2020-06-02 19:54           ` Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2020-06-02  4:36 [PATCH] " Navid Emamdoost
2020-06-02  9:54 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).