From: Vinod Koul <vkoul@kernel.org>
To: Navid Emamdoost <navid.emamdoost@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>,
wu000273@umn.edu, kjlu@umn.edu, linux-kernel@vger.kernel.org,
emamd001@umn.edu, Maxime Coquelin <mcoquelin.stm32@gmail.com>,
smccaman@umn.edu, dmaengine@vger.kernel.org,
Dan Williams <dan.j.williams@intel.com>,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] dmaengine: stm32-dmamux: fix pm_runtime_get_sync fialure cases
Date: Wed, 24 Jun 2020 13:10:15 +0530 [thread overview]
Message-ID: <20200624074015.GP2324254@vkoul-mobl> (raw)
In-Reply-To: <20200603193648.19190-1-navid.emamdoost@gmail.com>
On 03-06-20, 14:36, Navid Emamdoost wrote:
s/fialure/failure
> Calling pm_runtime_get_sync increments the counter even in case of
> failure, causing incorrect ref count. Call pm_runtime_put_sync if
> pm_runtime_get_sync fails.
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
> drivers/dma/stm32-dmamux.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/stm32-dmamux.c b/drivers/dma/stm32-dmamux.c
> index 12f7637e13a1..ab250d7eed29 100644
> --- a/drivers/dma/stm32-dmamux.c
> +++ b/drivers/dma/stm32-dmamux.c
> @@ -140,6 +140,7 @@ static void *stm32_dmamux_route_allocate(struct of_phandle_args *dma_spec,
> ret = pm_runtime_get_sync(&pdev->dev);
> if (ret < 0) {
> spin_unlock_irqrestore(&dmamux->lock, flags);
> + pm_runtime_put_sync(&pdev->dev);
why put_sync()
> goto error;
> }
> spin_unlock_irqrestore(&dmamux->lock, flags);
> @@ -340,8 +341,10 @@ static int stm32_dmamux_suspend(struct device *dev)
> int i, ret;
>
> ret = pm_runtime_get_sync(dev);
> - if (ret < 0)
> + if (ret < 0) {
> + pm_runtime_put_sync(dev);
here too
> return ret;
> + }
>
> for (i = 0; i < stm32_dmamux->dma_requests; i++)
> stm32_dmamux->ccr[i] = stm32_dmamux_read(stm32_dmamux->iomem,
> --
> 2.17.1
--
~Vinod
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-06-24 7:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-03 19:36 [PATCH] dmaengine: stm32-dmamux: fix pm_runtime_get_sync fialure cases Navid Emamdoost
2020-06-24 7:40 ` Vinod Koul [this message]
2020-06-24 7:56 ` Navid Emamdoost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200624074015.GP2324254@vkoul-mobl \
--to=vkoul@kernel.org \
--cc=alexandre.torgue@st.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=emamd001@umn.edu \
--cc=kjlu@umn.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=navid.emamdoost@gmail.com \
--cc=smccaman@umn.edu \
--cc=wu000273@umn.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox