From: Michael Dege <michael.dege@renesas.com>
To: "Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.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>,
"Richard Cochran" <richardcochran@gmail.com>,
"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Paul Barker" <paul@pbarker.dev>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Magnus Damm" <magnus.damm@gmail.com>
Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Nikita Yushchenko <nikita.yoush@cogentembedded.com>,
Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Michael Dege <michael.dege@renesas.com>
Subject: [PATCH net-next 10/10] net: renesas: rswitch: update error handling of probe
Date: Thu, 06 Nov 2025 13:55:34 +0100 [thread overview]
Message-ID: <20251106-add_l3_routing-v1-10-dcbb8368ca54@renesas.com> (raw)
In-Reply-To: <20251106-add_l3_routing-v1-0-dcbb8368ca54@renesas.com>
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Update error handling of probe function.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Michael Dege <michael.dege@renesas.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
next prev parent reply other threads:[~2025-11-06 12:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-06 12:55 [PATCH net-next 00/10] net: renesas: rswitch: R-Car S4 add HW offloading for layer 3 routing Michael Dege
2025-11-06 12:55 ` [PATCH net-next 01/10] net: renesas: rswitch: cleanup MII settings Michael Dege
2025-11-06 12:55 ` [PATCH net-next 02/10] net: renesas: rswitch: enable Phy link status pin Michael Dege
2025-11-07 1:16 ` Andrew Lunn
2025-11-07 13:37 ` Michael Dege
2025-11-06 12:55 ` [PATCH net-next 03/10] dt-bindings: net: renesas,r8a779f0-ether-switch.yaml: add optional property link-pin Michael Dege
2025-11-06 13:41 ` Geert Uytterhoeven
2025-11-06 14:19 ` Rob Herring (Arm)
2025-11-06 17:16 ` Conor Dooley
2025-11-06 12:55 ` [PATCH net-next 04/10] arm64: dts: renesas: r8a779f4-s4sk.dts add link-pin property Michael Dege
2025-11-06 12:55 ` [PATCH net-next 05/10] arm64: dts: renesas: r8a779f0-spider-ethernet.dtsi " Michael Dege
2025-11-06 12:55 ` [PATCH net-next 06/10] net: renesas: rswitch: add MAC address filtering Michael Dege
2025-11-07 1:18 ` Andrew Lunn
2025-11-06 12:55 ` [PATCH net-next 07/10] net: renesas: rswitch: fix FWPCx register names Michael Dege
2025-11-06 12:55 ` [PATCH net-next 08/10] net: renesas: rswitch: add bit access macros for forwarding engine Michael Dege
2025-11-06 12:55 ` [PATCH net-next 09/10] net: renesas: rswitch: add simple l3 routing Michael Dege
2025-11-07 2:32 ` Andrew Lunn
2025-11-07 10:02 ` Nikita Yushchenko
2025-11-07 13:29 ` Michael Dege
2025-11-07 13:46 ` Andrew Lunn
2025-11-07 13:35 ` Michael Dege
2025-11-06 12:55 ` Michael Dege [this message]
2025-11-07 2:32 ` [PATCH net-next 10/10] net: renesas: rswitch: update error handling of probe Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251106-add_l3_routing-v1-10-dcbb8368ca54@renesas.com \
--to=michael.dege@renesas.com \
--cc=andrew+netdev@lunn.ch \
--cc=christophe.jaillet@wanadoo.fr \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=geert+renesas@glider.be \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nikita.yoush@cogentembedded.com \
--cc=niklas.soderlund@ragnatech.se \
--cc=pabeni@redhat.com \
--cc=paul@pbarker.dev \
--cc=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=yoshihiro.shimoda.uh@renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).