]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mtd: rawnand: lpx32xx: Fix dma_request_chan() error checks
authorPiotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>
Fri, 5 Jul 2024 11:51:35 +0000 (13:51 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 17 Jul 2024 08:39:39 +0000 (10:39 +0200)
The dma_request_chan() returns error pointer in case of error, while
dma_request_channel() returns NULL in case of error therefore different
error checks are needed for the two.

Fixes: 7326d3fb1ee3 ("mtd: rawnand: lpx32xx: Request DMA channels using DT entries")
Signed-off-by: Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com>
Cc: stable@vger.kernel.org
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20240705115139.126522-1-piotr.wojtaszczyk@timesys.com
drivers/mtd/nand/raw/lpc32xx_mlc.c
drivers/mtd/nand/raw/lpc32xx_slc.c

index 92cebe871bb45515739c87313f98331768297fdd..b9c3adc54c010266fc39ffed8898d7a1e8d5d0ed 100644 (file)
@@ -575,7 +575,7 @@ static int lpc32xx_dma_setup(struct lpc32xx_nand_host *host)
        dma_cap_mask_t mask;
 
        host->dma_chan = dma_request_chan(mtd->dev.parent, "rx-tx");
-       if (!host->dma_chan) {
+       if (IS_ERR(host->dma_chan)) {
                /* fallback to request using platform data */
                if (!host->pdata || !host->pdata->dma_filter) {
                        dev_err(mtd->dev.parent, "no DMA platform data\n");
index 3b7e3d259785a83dae82ed8265a47366116b5589..ade971e4cc3b2990e248e2dde4cd59f39b01afad 100644 (file)
@@ -722,7 +722,7 @@ static int lpc32xx_nand_dma_setup(struct lpc32xx_nand_host *host)
        dma_cap_mask_t mask;
 
        host->dma_chan = dma_request_chan(mtd->dev.parent, "rx-tx");
-       if (!host->dma_chan) {
+       if (IS_ERR(host->dma_chan)) {
                /* fallback to request using platform data */
                if (!host->pdata || !host->pdata->dma_filter) {
                        dev_err(mtd->dev.parent, "no DMA platform data\n");