Skip to content

Commit 10e3cc1

Browse files
tititiou36davem330
authored andcommitted
net/sonic: Fix a resource leak in an error handling path in 'jazz_sonic_probe()'
A call to 'dma_alloc_coherent()' is hidden in 'sonic_alloc_descriptors()', called from 'sonic_probe1()'. This is correctly freed in the remove function, but not in the error handling path of the probe function. Fix it and add the missing 'dma_free_coherent()' call. While at it, rename a label in order to be slightly more informative. Fixes: efcce83 ("[PATCH] macsonic/jazzsonic network drivers update") Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4b5b71f commit 10e3cc1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/net/ethernet/natsemi/jazzsonic.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,13 @@ static int jazz_sonic_probe(struct platform_device *pdev)
208208

209209
err = register_netdev(dev);
210210
if (err)
211-
goto out1;
211+
goto undo_probe1;
212212

213213
return 0;
214214

215-
out1:
215+
undo_probe1:
216+
dma_free_coherent(lp->device, SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
217+
lp->descriptors, lp->descriptors_laddr);
216218
release_mem_region(dev->base_addr, SONIC_MEM_SIZE);
217219
out:
218220
free_netdev(dev);

0 commit comments

Comments
 (0)