Skip to content

Commit 3920a75

Browse files
sperezglzkuba-moo
authored andcommitted
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. Link: https://scan7.scan.coverity.com/#/project-view/53936/11354?selectedIssue=1643754 Signed-off-by: Sergio Perez Gonzalez <[email protected]> Reviewed-by: Claudiu Beznea <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 126cd78 commit 3920a75

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5283,7 +5283,11 @@ static int macb_probe(struct platform_device *pdev)
52835283

52845284
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
52855285
if (GEM_BFEXT(DAW64, gem_readl(bp, DCFG6))) {
5286-
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44));
5286+
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44));
5287+
if (err) {
5288+
dev_err(&pdev->dev, "failed to set DMA mask\n");
5289+
goto err_out_free_netdev;
5290+
}
52875291
bp->hw_dma_cap |= HW_DMA_CAP_64B;
52885292
}
52895293
#endif

0 commit comments

Comments
 (0)