Message ID | 93888efa-c838-4682-a7e5-e6bf318e844e@stanley.mountain (mailing list archive) |
---|---|
State | Accepted |
Commit | f66af9616148e10e04eb172c7616ad79912b446e |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] net: enetc: clean up before returning in probe() | expand |
> -----Original Message----- > From: Dan Carpenter <dan.carpenter@linaro.org> > Sent: 2024年11月13日 15:31 > To: Wei Fang <wei.fang@nxp.com> > Cc: Claudiu Manoil <claudiu.manoil@nxp.com>; Vladimir Oltean > <vladimir.oltean@nxp.com>; Clark Wang <xiaoning.wang@nxp.com>; Andrew > Lunn <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric > Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo > Abeni <pabeni@redhat.com>; Frank Li <frank.li@nxp.com>; imx@lists.linux.dev; > netdev@vger.kernel.org; linux-kernel@vger.kernel.org; > kernel-janitors@vger.kernel.org > 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@linaro.org> > --- > 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@nxp.com>
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <kuba@kernel.org>: On Wed, 13 Nov 2024 10:31:25 +0300 you wrote: > 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@linaro.org> > --- > drivers/net/ethernet/freescale/enetc/enetc_vf.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) Here is the summary with links: - [net-next] net: enetc: clean up before returning in probe() https://git.kernel.org/netdev/net-next/c/f66af9616148 You are awesome, thank you!
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);
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@linaro.org> --- drivers/net/ethernet/freescale/enetc/enetc_vf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)