linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] spi: sprd: call pm_runtime_put if pm_runtime_get_sync fails
@ 2020-06-02  9:05 Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-06-02  9:05 UTC (permalink / raw)
  To: Navid Emamdoost, linux-spi
  Cc: Navid Emamdoost, Kangjie Lu, Stephen McCamant, Qiushi Wu,
	Baolin Wang, Mark Brown, Orson Zhai, Chunyan Zhang, Dinghao Liu,
	LKML, kernel-janitors

> Call to pm_runtime_get_sync increments counter even in case of
> failure leading to incorrect ref count.
> Call pm_runtime_put_noidle if pm_runtime_get_sync fails.

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_noidle” 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] 3+ messages in thread

* Re: [PATCH] spi: sprd: call pm_runtime_put if pm_runtime_get_sync fails
  2020-06-02  5:19 Navid Emamdoost
@ 2020-06-02 13:59 ` Baolin Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Baolin Wang @ 2020-06-02 13:59 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: Mark Brown, Orson Zhai, Chunyan Zhang, linux-spi, LKML, emamd001,
	wu000273, kjlu, smccaman

Hi,

On Tue, Jun 2, 2020 at 1:20 PM Navid Emamdoost
<navid.emamdoost@gmail.com> wrote:
>
> Call to pm_runtime_get_sync increments counter even in case of
> failure leading to incorrect ref count.
> Call pm_runtime_put_noidle if pm_runtime_get_sync fails.
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>

Looks good to me. Thanks
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>

> ---
>  drivers/spi/spi-sprd.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c
> index 6678f1cbc566..860032af4b98 100644
> --- a/drivers/spi/spi-sprd.c
> +++ b/drivers/spi/spi-sprd.c
> @@ -1018,6 +1018,7 @@ static int sprd_spi_remove(struct platform_device *pdev)
>         ret = pm_runtime_get_sync(ss->dev);
>         if (ret < 0) {
>                 dev_err(ss->dev, "failed to resume SPI controller\n");
> +               pm_runtime_put_noidle(&pdev->dev);
>                 return ret;
>         }
>
> --
> 2.17.1
>


-- 
Baolin Wang

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

* [PATCH] spi: sprd: call pm_runtime_put if pm_runtime_get_sync fails
@ 2020-06-02  5:19 Navid Emamdoost
  2020-06-02 13:59 ` Baolin Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Navid Emamdoost @ 2020-06-02  5:19 UTC (permalink / raw)
  To: Mark Brown, Orson Zhai, Baolin Wang, Chunyan Zhang, linux-spi,
	linux-kernel
  Cc: emamd001, wu000273, kjlu, smccaman, Navid Emamdoost

Call to pm_runtime_get_sync increments counter even in case of
failure leading to incorrect ref count.
Call pm_runtime_put_noidle if pm_runtime_get_sync fails.

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

diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c
index 6678f1cbc566..860032af4b98 100644
--- a/drivers/spi/spi-sprd.c
+++ b/drivers/spi/spi-sprd.c
@@ -1018,6 +1018,7 @@ static int sprd_spi_remove(struct platform_device *pdev)
 	ret = pm_runtime_get_sync(ss->dev);
 	if (ret < 0) {
 		dev_err(ss->dev, "failed to resume SPI controller\n");
+		pm_runtime_put_noidle(&pdev->dev);
 		return ret;
 	}
 
-- 
2.17.1


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02  9:05 [PATCH] spi: sprd: call pm_runtime_put if pm_runtime_get_sync fails Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2020-06-02  5:19 Navid Emamdoost
2020-06-02 13:59 ` Baolin Wang

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).