]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mtd: nand: realtek-ecc: Fix a IS_ERR() vs NULL bug in probe
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 3 Oct 2025 09:30:10 +0000 (12:30 +0300)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 22 Oct 2025 09:54:18 +0000 (11:54 +0200)
The dma_alloc_noncoherent() function doesn't return error pointers, it
returns NULL on error.  Fix the error checking to match.

Fixes: 3148d0e5b1c5 ("mtd: nand: realtek-ecc: Add Realtek external ECC engine support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/ecc-realtek.c

index 7d718934c909629f02984fa1fa6afd3f97242e36..7c275f1eb4a7b6b5ccb03ba22cbc40d6957cd410 100644 (file)
@@ -418,8 +418,8 @@ static int rtl_ecc_probe(struct platform_device *pdev)
 
        rtlc->buf = dma_alloc_noncoherent(dev, RTL_ECC_DMA_SIZE, &rtlc->buf_dma,
                                          DMA_BIDIRECTIONAL, GFP_KERNEL);
-       if (IS_ERR(rtlc->buf))
-               return PTR_ERR(rtlc->buf);
+       if (!rtlc->buf)
+               return -ENOMEM;
 
        rtlc->dev = dev;
        rtlc->engine.dev = dev;