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

From: Markus Elfring
Date: Mon May 11 2020 - 03:55:16 EST


> 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


â
> +++ 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