RE: [PATCH net-next] net: enetc: clean up before returning in probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Sent: 2024年11月13日 15:31
> To: Wei Fang <wei.fang@xxxxxxx>
> Cc: Claudiu Manoil <claudiu.manoil@xxxxxxx>; Vladimir Oltean
> <vladimir.oltean@xxxxxxx>; Clark Wang <xiaoning.wang@xxxxxxx>; Andrew
> Lunn <andrew+netdev@xxxxxxx>; David S. Miller <davem@xxxxxxxxxxxxx>; Eric
> Dumazet <edumazet@xxxxxxxxxx>; Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo
> Abeni <pabeni@xxxxxxxxxx>; Frank Li <frank.li@xxxxxxx>; imx@xxxxxxxxxxxxxxx;
> netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> kernel-janitors@xxxxxxxxxxxxxxx
> Subject: [PATCH net-next] net: enetc: clean up before returning in probe()
> 
> We recently added this error  path.  We need to call enetc_pci_remove()
> before returning.  It cleans up the resources from enetc_pci_probe().
> 
> Fixes: 99100d0d9922 ("net: enetc: add preliminary support for i.MX95 ENETC
> PF")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
>  drivers/net/ethernet/freescale/enetc/enetc_vf.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_vf.c
> b/drivers/net/ethernet/freescale/enetc/enetc_vf.c
> index d18c11e406fc..a5f8ce576b6e 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c
> @@ -174,9 +174,11 @@ static int enetc_vf_probe(struct pci_dev *pdev,
>  	si = pci_get_drvdata(pdev);
>  	si->revision = ENETC_REV_1_0;
>  	err = enetc_get_driver_data(si);
> -	if (err)
> -		return dev_err_probe(&pdev->dev, err,
> -				     "Could not get VF driver data\n");
> +	if (err) {
> +		dev_err_probe(&pdev->dev, err,
> +			      "Could not get VF driver data\n");
> +		goto err_alloc_netdev;
> +	}
> 
>  	enetc_get_si_caps(si);
> 
> --
> 2.45.2

Thanks for fixing this error path.

Reviewed-by: Wei Fang <wei.fang@xxxxxxx>





[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux