Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Keguang Zhang <keguang.zhang@gmail.com>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mips@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] mtd: rawnand: loongson1: Fix error code in ls1x_nand_dma_transfer()
Date: Tue, 6 May 2025 12:32:45 +0300	[thread overview]
Message-ID: <aBnXPYLSNJASR51f@stanley.mountain> (raw)
In-Reply-To: <CAJhJPsUZz2kwMyWPDrc_ktb5O6ECcAyO1OrXXVWh9yvkrKRidg@mail.gmail.com>

On Tue, May 06, 2025 at 05:16:03PM +0800, Keguang Zhang wrote:
> On Fri, May 2, 2025 at 4:39 PM Dan Carpenter <dan.carpenter@linaro.org> wrote:
> >
> > The "desc" variable is NULL and PTR_ERR(NULL) is zero/success.  Return
> > a negative error code instead.
> >
> > Fixes: d2d10ede04b1 ("mtd: rawnand: Add Loongson-1 NAND Controller Driver")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> > It's hard to know what the patch prefix should be here.  Ideally when we
> > add a new driver we would use the patch prefix for the driver.
> >
> > Tired: subsystem: Add driver XXX
> > Wired: subsystem: XXX: Add driver for XXX
> >
> >  drivers/mtd/nand/raw/loongson1-nand-controller.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/nand/raw/loongson1-nand-controller.c b/drivers/mtd/nand/raw/loongson1-nand-controller.c
> > index 6a369b1c7d86..8754bb4f8b56 100644
> > --- a/drivers/mtd/nand/raw/loongson1-nand-controller.c
> > +++ b/drivers/mtd/nand/raw/loongson1-nand-controller.c
> > @@ -371,7 +371,7 @@ static int ls1x_nand_dma_transfer(struct ls1x_nand_host *host, struct ls1x_nand_
> >         desc = dmaengine_prep_slave_single(chan, dma_addr, op->len, xfer_dir, DMA_PREP_INTERRUPT);
> >         if (!desc) {
> >                 dev_err(dev, "failed to prepare DMA descriptor\n");
> > -               ret = PTR_ERR(desc);
> > +               ret = -ENOMEM;
> 
> Thank you for fixing this issue.
> However, I believe -EIO is more appropriate than -ENOMEM, since
> dmaengine_prep_slave_single() can return errors other than -ENOMEM.
> 

It's not an I/O error so -EIO isn't correct.

There are a bunch of reasons it could fail but most likely
dma_pool_alloc() failed.  I think -ENOMEM is correct.

regards,
dan carpenter


  reply	other threads:[~2025-05-06  9:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02  8:39 [PATCH next] mtd: rawnand: loongson1: Fix error code in ls1x_nand_dma_transfer() Dan Carpenter
2025-05-06  9:16 ` Keguang Zhang
2025-05-06  9:32   ` Dan Carpenter [this message]
2025-05-06 10:01     ` Keguang Zhang
2025-05-06 11:15       ` Dan Carpenter
2025-05-06 12:12         ` Keguang Zhang
2025-05-12 14:29 ` Miquel Raynal

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=aBnXPYLSNJASR51f@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=keguang.zhang@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /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