Re: [PATCH 1/3] net: xilinx: fix possible object reference leak
From: Markus Elfring
Date: Fri Apr 05 2019 - 03:55:27 EST
> @@ -1575,12 +1575,14 @@ static int axienet_probe(struct platform_device *pdev)
> ret = of_address_to_resource(np, 0, &dmares);
> if (ret) {
> dev_err(&pdev->dev, "unable to get DMA resource\n");
> + of_node_put(np);
> goto free_netdev;
> }
> lp->dma_regs = devm_ioremap_resource(&pdev->dev, &dmares);
> if (IS_ERR(lp->dma_regs)) {
> dev_err(&pdev->dev, "could not map DMA regs\n");
> ret = PTR_ERR(lp->dma_regs);
> + of_node_put(np);
> goto free_netdev;
> }
How do you think about to move these put calls to an additional
jump target for the desired exception handling?
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/net/ethernet/xilinx/xilinx_axienet_main.c?id=fa3a419d2f674b431d38748cb58fb7da17ee8949#n1621
Regards,
Markus