Thread (1 message) 1 message, 1 author, 2020-05-11

Re: [PATCH v2] net/sonic: Fix some resource leaks in error handling paths

From: Markus Elfring <hidden>
Date: 2020-05-11 07:55:16
Also in: kernel-janitors, lkml

Changed since v1:
 - Improved commit log slightly.
 - Changed 'undo_probe1' to 'undo_probe' where appropriate.
I find this response interesting.

---
I suggest to replace these triple dashes by a blank line.

 drivers/net/ethernet/natsemi/macsonic.c | 17 +++++++++++++----
 drivers/net/ethernet/natsemi/xtsonic.c  |  7 +++++--
I imagine that this change combination will need further clarification
because David Miller provided the information “Applied, thanks.” on 2020-04-27.

net/sonic: Fix a resource leak in an error handling path in 'jazz_sonic_probe()'
https://lore.kernel.org/patchwork/comment/1426045/
https://lkml.org/lkml/2020/4/27/1014
quoted hunk
+++ b/drivers/net/ethernet/natsemi/xtsonic.c
@@ -229,11 +229,14 @@ int xtsonic_probe(struct platform_device *pdev)
 	sonic_msg_init(dev);

 	if ((err = register_netdev(dev)))
-		goto out1;
+		goto undo_probe1;

 	return 0;

-out1:
+undo_probe1:
+	dma_free_coherent(lp->device,
+			  SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
+			  lp->descriptors, lp->descriptors_laddr);
 	release_region(dev->base_addr, SONIC_MEM_SIZE);
 out:
…

Can it be nicer to use the label “free_dma”?

Regards,
Markus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help