[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEkB2EQ6AquKCexaaauHcsQXP4Y5hsri5FqehKqiw7deex5kQw@mail.gmail.com>
Date: Wed, 24 Jun 2020 02:48:58 -0500
From: Navid Emamdoost <navid.emamdoost@...il.com>
To: Vinod Koul <vkoul@...nel.org>
Cc: Dan Williams <dan.j.williams@...el.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...com>,
dmaengine@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org,
LKML <linux-kernel@...r.kernel.org>,
Navid Emamdoost <emamd001@....edu>,
Qiushi Wu <wu000273@....edu>, Kangjie Lu <kjlu@....edu>,
Stephen McCamant <smccaman@....edu>
Subject: Re: [PATCH] engine: stm32-dma: call pm_runtime_put if
pm_runtime_get_sync fails
Hi,
On Wed, Jun 24, 2020 at 2:39 AM Vinod Koul <vkoul@...nel.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@...il.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.
Powered by blists - more mailing lists