dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: Vinod Koul <vkoul@kernel.org>
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,
	LKML <linux-kernel@vger.kernel.org>,
	Navid Emamdoost <emamd001@umn.edu>, Qiushi Wu <wu000273@umn.edu>,
	Kangjie Lu <kjlu@umn.edu>, Stephen McCamant <smccaman@umn.edu>
Subject: Re: [PATCH] engine: stm32-dma: call pm_runtime_put if pm_runtime_get_sync fails
Date: Wed, 24 Jun 2020 02:48:58 -0500	[thread overview]
Message-ID: <CAEkB2EQ6AquKCexaaauHcsQXP4Y5hsri5FqehKqiw7deex5kQw@mail.gmail.com> (raw)
In-Reply-To: <20200624073932.GO2324254@vkoul-mobl>

Hi,

On Wed, Jun 24, 2020 at 2:39 AM Vinod Koul <vkoul@kernel.org> wrote:
>
> 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()

My bad! I will fix it.

> >               return ret;
> > +     }
> >
> >       for (id = 0; id < STM32_DMA_MAX_CHANNELS; id++) {
> >               scr = stm32_dma_read(dmadev, STM32_DMA_SCR(id));
> > --
> > 2.17.1
>
> --
> ~Vinod



-- 
Navid.

      reply	other threads:[~2020-06-24  7:49 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
2020-06-24  7:48   ` Navid Emamdoost [this message]

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=CAEkB2EQ6AquKCexaaauHcsQXP4Y5hsri5FqehKqiw7deex5kQw@mail.gmail.com \
    --to=navid.emamdoost@gmail.com \
    --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=smccaman@umn.edu \
    --cc=vkoul@kernel.org \
    --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).