]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mtd: rawnand: loongson1: Fix error code in ls1x_nand_dma_transfer()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 2 May 2025 08:39:29 +0000 (11:39 +0300)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 12 May 2025 14:28:15 +0000 (16:28 +0200)
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>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/loongson1-nand-controller.c

index 6a369b1c7d864f100e453680e8b3d4c5e939c9c8..8754bb4f8b56820523e6e404c865c48c44396140 100644 (file)
@@ -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;
                goto err;
        }
        desc->callback = ls1x_nand_dma_callback;