[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251106-add_l3_routing-v1-10-dcbb8368ca54@renesas.com>
Date: Thu, 06 Nov 2025 13:55:34 +0100
From: Michael Dege <michael.dege@...esas.com>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Richard Cochran <richardcochran@...il.com>,
Niklas Söderlund <niklas.soderlund@...natech.se>,
Paul Barker <paul@...rker.dev>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>
Cc: netdev@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
Nikita Yushchenko <nikita.yoush@...entembedded.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Michael Dege <michael.dege@...esas.com>
Subject: [PATCH net-next 10/10] net: renesas: rswitch: update error
handling of probe
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Update error handling of probe function.
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Signed-off-by: Michael Dege <michael.dege@...esas.com>
---
drivers/net/ethernet/renesas/rswitch_main.c | 63 ++++++++++++++++-------------
1 file changed, 34 insertions(+), 29 deletions(-)
diff --git a/drivers/net/ethernet/renesas/rswitch_main.c b/drivers/net/ethernet/renesas/rswitch_main.c
index 8d56ef037a8d..1d8f141a25d3 100644
--- a/drivers/net/ethernet/renesas/rswitch_main.c
+++ b/drivers/net/ethernet/renesas/rswitch_main.c
@@ -2231,6 +2231,30 @@ static const struct soc_device_attribute rswitch_soc_no_speed_change[] = {
{ /* Sentinel */ }
};
+static void rswitch_deinit(struct rswitch_private *priv)
+{
+ unsigned int i;
+
+ rswitch_gwca_hw_deinit(priv);
+ rcar_gen4_ptp_unregister(priv->ptp_priv);
+
+ rswitch_for_each_enabled_port(priv, i) {
+ struct rswitch_device *rdev = priv->rdev[i];
+
+ unregister_netdev(rdev->ndev);
+ rswitch_ether_port_deinit_one(rdev);
+ phy_exit(priv->rdev[i]->serdes);
+ }
+
+ for (i = 0; i < RSWITCH_NUM_PORTS; i++)
+ rswitch_device_free(priv, i);
+
+ rswitch_gwca_ts_queue_free(priv);
+ rswitch_gwca_linkfix_free(priv);
+
+ rswitch_clock_disable(priv);
+}
+
static int renesas_eth_sw_probe(struct platform_device *pdev)
{
const struct soc_device_attribute *attr;
@@ -2294,11 +2318,8 @@ static int renesas_eth_sw_probe(struct platform_device *pdev)
pm_runtime_get_sync(&pdev->dev);
ret = rswitch_init(priv);
- if (ret < 0) {
- pm_runtime_put(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
- return ret;
- }
+ if (ret < 0)
+ goto err_disable_pm_runtime;
if (list_empty(&priv->port_list))
dev_warn(&pdev->dev, "could not initialize any ports\n");
@@ -2306,36 +2327,20 @@ static int renesas_eth_sw_probe(struct platform_device *pdev)
ret = rswitch_register_notifiers();
if (ret) {
dev_err(&pdev->dev, "could not register notifiers\n");
- return ret;
+ goto err_deinit_rswitch;
}
device_set_wakeup_capable(&pdev->dev, 1);
- return ret;
-}
-
-static void rswitch_deinit(struct rswitch_private *priv)
-{
- unsigned int i;
-
- rswitch_gwca_hw_deinit(priv);
- rcar_gen4_ptp_unregister(priv->ptp_priv);
-
- rswitch_for_each_enabled_port(priv, i) {
- struct rswitch_device *rdev = priv->rdev[i];
-
- unregister_netdev(rdev->ndev);
- rswitch_ether_port_deinit_one(rdev);
- phy_exit(priv->rdev[i]->serdes);
- }
-
- for (i = 0; i < RSWITCH_NUM_PORTS; i++)
- rswitch_device_free(priv, i);
+ return 0;
- rswitch_gwca_ts_queue_free(priv);
- rswitch_gwca_linkfix_free(priv);
+err_deinit_rswitch:
+ rswitch_deinit(priv);
+err_disable_pm_runtime:
+ pm_runtime_put(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
- rswitch_clock_disable(priv);
+ return ret;
}
static void renesas_eth_sw_remove(struct platform_device *pdev)
--
2.43.0
Powered by blists - more mailing lists