From: Vinod Koul <vkoul@kernel.org>
To: Navid Emamdoost <navid.emamdoost@gmail.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@st.com>,
dmaengine@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, emamd001@umn.edu, wu000273@umn.edu,
kjlu@umn.edu, smccaman@umn.edu
Subject: Re: [PATCH] engine: stm32-dma: call pm_runtime_put if pm_runtime_get_sync fails
Date: Wed, 24 Jun 2020 13:09:32 +0530 [thread overview]
Message-ID: <20200624073932.GO2324254@vkoul-mobl> (raw)
In-Reply-To: <20200603183410.76764-1-navid.emamdoost@gmail.com>
On 03-06-20, 13:34, Navid Emamdoost wrote:
> 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.
pls fix subsystem name as dmaengine: ...
>
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
> drivers/dma/stm32-dma.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c
> index 0ddbaa4b4f0b..0aab86bd97fe 100644
> --- a/drivers/dma/stm32-dma.c
> +++ b/drivers/dma/stm32-dma.c
> @@ -1169,8 +1169,10 @@ static int stm32_dma_alloc_chan_resources(struct dma_chan *c)
> chan->config_init = false;
>
> ret = pm_runtime_get_sync(dmadev->ddev.dev);
> - if (ret < 0)
> + if (ret < 0) {
> + pm_runtime_put(dmadev->ddev.dev);
> return ret;
> + }
>
> ret = stm32_dma_disable_chan(chan);
> if (ret < 0)
> @@ -1439,8 +1441,10 @@ static int stm32_dma_suspend(struct device *dev)
> int id, ret, scr;
>
> ret = pm_runtime_get_sync(dev);
> - if (ret < 0)
> + if (ret < 0) {
> + pm_runtime_put_sync(dev);
why put_sync()
> return ret;
> + }
>
> for (id = 0; id < STM32_DMA_MAX_CHANNELS; id++) {
> scr = stm32_dma_read(dmadev, STM32_DMA_SCR(id));
> --
> 2.17.1
--
~Vinod
next prev parent reply other threads:[~2020-06-24 7:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-03 18:34 [PATCH] engine: stm32-dma: call pm_runtime_put if pm_runtime_get_sync fails Navid Emamdoost
2020-06-24 7:39 ` Vinod Koul [this message]
2020-06-24 7:48 ` 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=20200624073932.GO2324254@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;
as well as URLs for NNTP newsgroup(s).