diff mbox series

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

Message ID 93888efa-c838-4682-a7e5-e6bf318e844e@stanley.mountain (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: enetc: clean up before returning in probe() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 11 of 11 maintainers
netdev/build_clang success Errors and warnings before: 3 this patch: 3
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-11-14--03-00 (tests: 782)

Commit Message

Dan Carpenter Nov. 13, 2024, 7:31 a.m. UTC
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(-)

Comments

Wei Fang Nov. 13, 2024, 7:42 a.m. UTC | #1
> -----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>
diff mbox series

Patch

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);