Skip to content

Commit 760b9b4

Browse files
Thomas-fouriermaddy-kerneldev
authored andcommitted
(powerpc/512) Fix possible dma_unmap_single() on uninitialized pointer
If the device configuration fails (if `dma_dev->device_config()`), `sg_dma_address(&sg)` is not initialized and the jump to `err_dma_prep` leads to calling `dma_unmap_single()` on `sg_dma_address(&sg)`. Signed-off-by: Thomas Fourier <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Signed-off-by: Madhavan Srinivasan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent cf183c1 commit 760b9b4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

arch/powerpc/platforms/512x/mpc512x_lpbfifo.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,8 @@ static int mpc512x_lpbfifo_kick(void)
240240
dma_conf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
241241

242242
/* Make DMA channel work with LPB FIFO data register */
243-
if (dma_dev->device_config(lpbfifo.chan, &dma_conf)) {
244-
ret = -EINVAL;
245-
goto err_dma_prep;
246-
}
243+
if (dma_dev->device_config(lpbfifo.chan, &dma_conf))
244+
return -EINVAL;
247245

248246
sg_init_table(&sg, 1);
249247

0 commit comments

Comments
 (0)