From: Thomas Fourier <hidden> Date: 2025-06-05 16:39:39
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 <redacted>
---
arch/powerpc/platforms/512x/mpc512x_lpbfifo.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -241,8 +241,7 @@ static int mpc512x_lpbfifo_kick(void)/* Make DMA channel work with LPB FIFO data register */if(dma_dev->device_config(lpbfifo.chan,&dma_conf)){-ret=-EINVAL;-gotoerr_dma_prep;+return-EINVAL;}sg_init_table(&sg,1);
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2025-06-09 00:50:10
Thomas Fourier [off-list ref] writes:
quoted hunk
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 <redacted>
---
arch/powerpc/platforms/512x/mpc512x_lpbfifo.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -241,8 +241,7 @@ static int mpc512x_lpbfifo_kick(void)/* Make DMA channel work with LPB FIFO data register */if(dma_dev->device_config(lpbfifo.chan,&dma_conf)){-ret=-EINVAL;-gotoerr_dma_prep;+return-EINVAL;}sg_init_table(&sg,1);
Yep looks good. That's the first use of goto for error handling, and
it's clearly too early. All the previous error cases do a direct return.
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au>
cheers
[Vous ne recevez pas souvent de courriers de fourier.thomas@gmail.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
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 <redacted>
---
arch/powerpc/platforms/512x/mpc512x_lpbfifo.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
@@ -241,8 +241,7 @@ static int mpc512x_lpbfifo_kick(void)/* Make DMA channel work with LPB FIFO data register */if(dma_dev->device_config(lpbfifo.chan,&dma_conf)){-ret=-EINVAL;-gotoerr_dma_prep;+return-EINVAL;}
You should remove the { } as it is now a single line.