net: macb: Check return value of dma_set_mask_and_coherent()
Subsystems (3)
PATCH 1/1 net: macb: Check return value of dma_set_mask_and_coherent()
Issue flagged by coverity. Add a safety check for the return value of dma_set_mask_and_coherent, go to a safe exit if it returns error.
Signed-off-by Sergio Perez Gonzalez <[email protected]>
--- drivers/net/ethernet/cadence/macb_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/cadence/macb_main.c +5 -1
@@ -5283,7 +5283,11 @@ static int macb_probe(struct platform_device *pdev)#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT if (GEM_BFEXT (DAW64 ,gem_readl (bp,DCFG6 ))) { -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (44 )); + err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (44 )); +if (err) { +dev_err (&pdev->dev,"failed to set DMA mask\n" ); + goto err_out_free_netdev; + } bp->hw_dma_cap |=HW_DMA_CAP_64B ; }#endif
Signature · 1 line
2.43.0
Quoted 6 lines · Sergio Perez Gonzalez
Issue flagged by coverity. Add a safety check for the return value of
dma_set_mask_and_coherent, go to a safe exit if it returns error.Signed-off-by Sergio Perez Gonzalez <[email protected]>
Reviewed-by Claudiu Beznea <[email protected]>
Quoted 21 lines
--- drivers/net/ethernet/cadence/macb_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/net/ethernet/cadence/macb_main.c +5
-1@@ -5283,7 +5283,11 @@ static int macb_probe(struct platform_device *pdev)#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT if (GEM_BFEXT (DAW64 ,gem_readl (bp,DCFG6 ))) { -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (44 )); + err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (44 )); +if (err) { +dev_err (&pdev->dev,"failed to set DMA mask\n" ); + goto err_out_free_netdev; + } bp->hw_dma_cap |=HW_DMA_CAP_64B ; }#endif
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Sun, 25 May 2025 21:20:31 -0600 you wrote:
Issue flagged by coverity. Add a safety check for the return value of
dma_set_mask_and_coherent, go to a safe exit if it returns error.Signed-off-by Sergio Perez Gonzalez <[email protected]>[...]
Here is the summary with links:
- net: macb: Check return value of dma_set_mask_and_coherent()
https://git.kernel.org/netdev/net/c/3920a7588007
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html