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:53 -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 1/3] fec: Do not set fep->clk_ptp to NULL on error

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

There is no need to set fep->clk_ptp to NULL when devm_clk_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 | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 89355a7..76e4f56 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1610,7 +1610,7 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
 			if (ret)
 				goto failed_clk_enet_out;
 		}
-		if (fep->clk_ptp) {
+		if (!IS_ERR(fep->clk_ptp)) {
 			mutex_lock(&fep->ptp_clk_mutex);
 			ret = clk_prepare_enable(fep->clk_ptp);
 			if (ret) {
@@ -1626,7 +1626,7 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
 		clk_disable_unprepare(fep->clk_ipg);
 		if (fep->clk_enet_out)
 			clk_disable_unprepare(fep->clk_enet_out);
-		if (fep->clk_ptp) {
+		if (!IS_ERR(fep->clk_ptp)) {
 			mutex_lock(&fep->ptp_clk_mutex);
 			clk_disable_unprepare(fep->clk_ptp);
 			fep->ptp_clk_on = false;
@@ -2640,10 +2640,8 @@ fec_probe(struct platform_device *pdev)
 	fep->clk_ptp = devm_clk_get(&pdev->dev, "ptp");
 	fep->bufdesc_ex =
 		pdev->id_entry->driver_data & FEC_QUIRK_HAS_BUFDESC_EX;
-	if (IS_ERR(fep->clk_ptp)) {
-		fep->clk_ptp = NULL;
+	if (IS_ERR(fep->clk_ptp))
 		fep->bufdesc_ex = 0;
-	}
 
 	ret = fec_enet_clk_enable(ndev, true);
 	if (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

Powered by Openwall GNU/*/Linux Powered by OpenVZ