Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: rawnand: intel: Fix an error handling path in 'ebu_dma_start()'

If 'dmaengine_prep_slave_single()' fails, we must undo a previous
'dma_map_single()' call, as already done in all the other error handling
paths of this function.

Fixes: 0b1039f016e8 ("mtd: rawnand: Add NAND controller support on Intel LGM SoC")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20210124073955.728797-1-christophe.jaillet@wanadoo.fr

authored by

Christophe JAILLET and committed by
Miquel Raynal
073abfa7 94d07f6a

+4 -2
+4 -2
drivers/mtd/nand/raw/intel-nand-controller.c
··· 318 318 } 319 319 320 320 tx = dmaengine_prep_slave_single(chan, buf_dma, len, dir, flags); 321 - if (!tx) 322 - return -ENXIO; 321 + if (!tx) { 322 + ret = -ENXIO; 323 + goto err_unmap; 324 + } 323 325 324 326 tx->callback = callback; 325 327 tx->callback_param = ebu_host;