Commit 9225f02f authored by Dan Carpenter's avatar Dan Carpenter Committed by Miquel Raynal
Browse files

mtd: nand: realtek-ecc: Fix a IS_ERR() vs NULL bug in probe



The dma_alloc_noncoherent() function doesn't return error pointers, it
returns NULL on error.  Fix the error checking to match.

Fixes: 3148d0e5 ("mtd: nand: realtek-ecc: Add Realtek external ECC engine support")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent e4185bed
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;