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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon,  1 Sep 2014 22:12:55 -0300
From:	Fabio Estevam <festevam@...il.com>
To:	davem@...emloft.net
Cc:	linux@....linux.org.uk, B38611@...escale.com,
	netdev@...r.kernel.org, Fabio Estevam <fabio.estevam@...escale.com>
Subject: [PATCH net-next 3/3] fec: Do not set fep->reg_phy to NULL on error

From: Fabio Estevam <fabio.estevam@...escale.com>

There is no need to set fep->reg_phy to NULL when devm_regulator_get()
returns an error. We can simply use IS_ERR() instead, which makes the code
simpler.

Signed-off-by: Fabio Estevam <fabio.estevam@...escale.com>
---
 drivers/net/ethernet/freescale/fec_main.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index e87cc66..39c28d1 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2653,8 +2653,6 @@ fec_probe(struct platform_device *pdev)
 				"Failed to enable phy regulator: %d\n", ret);
 			goto failed_regulator;
 		}
-	} else {
-		fep->reg_phy = NULL;
 	}
 
 	fec_reset_phy(pdev);
@@ -2704,7 +2702,7 @@ failed_register:
 failed_mii_init:
 failed_irq:
 failed_init:
-	if (fep->reg_phy)
+	if (!IS_ERR(fep->reg_phy))
 		regulator_disable(fep->reg_phy);
 failed_regulator:
 	fec_enet_clk_enable(ndev, false);
@@ -2727,7 +2725,7 @@ fec_drv_remove(struct platform_device *pdev)
 	cancel_work_sync(&fep->tx_timeout_work);
 	unregister_netdev(ndev);
 	fec_enet_mii_remove(fep);
-	if (fep->reg_phy)
+	if (!IS_ERR(fep->reg_phy))
 		regulator_disable(fep->reg_phy);
 	if (fep->ptp_clock)
 		ptp_clock_unregister(fep->ptp_clock);
@@ -2757,7 +2755,7 @@ static int __maybe_unused fec_suspend(struct device *dev)
 	fec_enet_clk_enable(ndev, false);
 	pinctrl_pm_select_sleep_state(&fep->pdev->dev);
 
-	if (fep->reg_phy)
+	if (!IS_ERR(fep->reg_phy))
 		regulator_disable(fep->reg_phy);
 
 	return 0;
@@ -2769,7 +2767,7 @@ static int __maybe_unused fec_resume(struct device *dev)
 	struct fec_enet_private *fep = netdev_priv(ndev);
 	int ret;
 
-	if (fep->reg_phy) {
+	if (!IS_ERR(fep->reg_phy)) {
 		ret = regulator_enable(fep->reg_phy);
 		if (ret)
 			return ret;
@@ -2794,7 +2792,7 @@ static int __maybe_unused fec_resume(struct device *dev)
 	return 0;
 
 failed_clk:
-	if (fep->reg_phy)
+	if (!IS_ERR(fep->reg_phy))
 		regulator_disable(fep->reg_phy);
 	return ret;
 }
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists