lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240822192600.141036-1-rosenp@gmail.com>
Date: Thu, 22 Aug 2024 12:25:53 -0700
From: Rosen Penev <rosenp@...il.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com,
	linux@...linux.org.uk,
	linux-kernel@...r.kernel.org,
	o.rempel@...gutronix.de,
	p.zabel@...gutronix.de
Subject: [PATCH net-next] net: ag71xx: add missing reset_control_put

The original downstream driver used devm instead of of. The latter
requires reset_control_put to be called in all return paths.

Signed-off-by: Rosen Penev <rosenp@...il.com>
---
 drivers/net/ethernet/atheros/ag71xx.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
index 89cd001b385f..e2aaec223c97 100644
--- a/drivers/net/ethernet/atheros/ag71xx.c
+++ b/drivers/net/ethernet/atheros/ag71xx.c
@@ -722,8 +722,10 @@ static int ag71xx_mdio_probe(struct ag71xx *ag)
 	mnp = of_get_child_by_name(np, "mdio");
 	err = devm_of_mdiobus_register(dev, mii_bus, mnp);
 	of_node_put(mnp);
-	if (err)
+	if (err) {
+		reset_control_put(ag->mdio_reset);
 		return err;
+	}
 
 	return 0;
 }
@@ -1916,20 +1918,24 @@ static int ag71xx_probe(struct platform_device *pdev)
 	ag71xx_hw_init(ag);
 
 	err = ag71xx_mdio_probe(ag);
-	if (err)
+	if (err) {
+		reset_control_put(ag->mdio_reset);
 		return err;
+	}
 
 	platform_set_drvdata(pdev, ndev);
 
 	err = ag71xx_phylink_setup(ag);
 	if (err) {
 		netif_err(ag, probe, ndev, "failed to setup phylink (%d)\n", err);
+		reset_control_put(ag->mdio_reset);
 		return err;
 	}
 
 	err = devm_register_netdev(&pdev->dev, ndev);
 	if (err) {
 		netif_err(ag, probe, ndev, "unable to register net device\n");
+		reset_control_put(ag->mdio_reset);
 		platform_set_drvdata(pdev, NULL);
 		return err;
 	}
@@ -1941,6 +1947,14 @@ static int ag71xx_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static void ag71xx_remove(struct platform_device *pdev)
+{
+	struct net_device *ndev = platform_get_drvdata(pdev);
+	struct ag71xx *ag = ag = netdev_priv(ndev);
+
+	reset_control_put(ag->mdio_reset);
+}
+
 static const u32 ar71xx_fifo_ar7100[] = {
 	0x0fff0000, 0x00001fff, 0x00780fff,
 };
@@ -2025,6 +2039,7 @@ static const struct of_device_id ag71xx_match[] = {
 
 static struct platform_driver ag71xx_driver = {
 	.probe		= ag71xx_probe,
+	.remove_new	= ag71xx_remove,
 	.driver = {
 		.name	= "ag71xx",
 		.of_match_table = ag71xx_match,
-- 
2.46.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ