dmaengine Archive on lore.kernel.org
 help / color / 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] dmaengine: stm32-dmamux: fix pm_runtime_get_sync fialure cases
Date: Wed, 24 Jun 2020 02:56:51 -0500
Message-ID: <CAEkB2ERfzxwkixX75CzCMeRRv51v-fM2zo2gpQrjtgaBZ_nNHQ@mail.gmail.com> (raw)
In-Reply-To: <20200624074015.GP2324254@vkoul-mobl>

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

Is put_noidle() better?

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



-- 
Navid.

      reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 19:36 Navid Emamdoost
2020-06-24  7:40 ` Vinod Koul
2020-06-24  7:56   ` 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=CAEkB2ERfzxwkixX75CzCMeRRv51v-fM2zo2gpQrjtgaBZ_nNHQ@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

dmaengine Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dmaengine/0 dmaengine/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dmaengine dmaengine/ https://lore.kernel.org/dmaengine \
		dmaengine@vger.kernel.org
	public-inbox-index dmaengine

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.dmaengine


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git