[PATCH] mtd: nand: gpmi: Release DMA channels on failure

Han Xu han.xu at nxp.com
Wed Jan 10 14:30:35 PST 2018


________________________________________
From: Boris Brezillon <boris.brezillon at free-electrons.com>
Sent: Wednesday, January 10, 2018 4:04 PM
To: Han Xu
Cc: Fabio Estevam; Fabio Estevam; linux-mtd at lists.infradead.org
Subject: Re: [PATCH] mtd: nand: gpmi: Release DMA channels on failure

Hi Han,

On Wed, 10 Jan 2018 21:50:41 +0000
Han Xu <han.xu at nxp.com> wrote:

> ________________________________________
> From: Fabio Estevam <festevam at gmail.com>
> Sent: Thursday, December 28, 2017 12:07 PM
> To: boris.brezillon at free-electrons.com
> Cc: Han Xu; linux-mtd at lists.infradead.org; Fabio Estevam
> Subject: [PATCH] mtd: nand: gpmi: Release DMA channels on failure
>
> From: Fabio Estevam <fabio.estevam at nxp.com>
>
> release_dma_channels() should be called in the case of error in
> gpmi_init() or bch_set_geometry(), because acquire_dma_channels() has
> been called previously.
>
> Handle the error cases correctly.
>
> Signed-off-by: Fabio Estevam <fabio.estevam at nxp.com>
> ---
>  drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> index 2ef8979..acfa5f5 100644
> --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
> @@ -2137,20 +2137,25 @@ static int gpmi_pm_resume(struct device *dev)
>         ret = gpmi_init(this);
>         if (ret) {
>                 dev_err(this->dev, "Error setting GPMI : %d\n", ret);
> -               return ret;
> +               goto release_dma_channels;
>         }
>
>         /* re-init the BCH registers */
>         ret = bch_set_geometry(this);
>         if (ret) {
>                 dev_err(this->dev, "Error setting BCH : %d\n", ret);
> -               return ret;
> +               goto release_dma_channels;
>         }
>
>         /* re-init others */
>         gpmi_extra_init(this);
>
>         return 0;
> +
> +release_dma_channels:
> +       release_dma_channels(this);
> +       return ret;
> +
>  }
>  #endif /* CONFIG_PM_SLEEP */
>
> Acked-by: Han Xu <han.xu at nxp.com>

Did you read my comment on v2 of this patch?

Sorry I missed the emails, I agree with you not to release the DMA even returning error.



More information about the linux-mtd mailing list