linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shawn.guo@linaro.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/4] net: fec: handle optional clk_ptp more gracefully
Date: Mon, 18 Mar 2013 16:26:22 +0800	[thread overview]
Message-ID: <1363595185-12302-2-git-send-email-shawn.guo@linaro.org> (raw)
In-Reply-To: <1363595185-12302-1-git-send-email-shawn.guo@linaro.org>

When the optional clk_ptp is absent, we can just set it to NULL, and
clk API will just handle it gracefully.  It saves us from checking
clk_ptp whenever calling into clk API.

Also since clk_ptp is optional, the "ret" variable shouldn't be set
in case that the clock is absent.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
 drivers/net/ethernet/freescale/fec.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index fccc3bf..d2a9851 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -1804,14 +1804,13 @@ fec_probe(struct platform_device *pdev)
 	fep->bufdesc_ex =
 		pdev->id_entry->driver_data & FEC_QUIRK_HAS_BUFDESC_EX;
 	if (IS_ERR(fep->clk_ptp)) {
-		ret = PTR_ERR(fep->clk_ptp);
+		fep->clk_ptp = NULL;
 		fep->bufdesc_ex = 0;
 	}
 
 	clk_prepare_enable(fep->clk_ahb);
 	clk_prepare_enable(fep->clk_ipg);
-	if (!IS_ERR(fep->clk_ptp))
-		clk_prepare_enable(fep->clk_ptp);
+	clk_prepare_enable(fep->clk_ptp);
 
 	reg_phy = devm_regulator_get(&pdev->dev, "phy");
 	if (!IS_ERR(reg_phy)) {
@@ -1876,8 +1875,7 @@ failed_irq:
 failed_regulator:
 	clk_disable_unprepare(fep->clk_ahb);
 	clk_disable_unprepare(fep->clk_ipg);
-	if (!IS_ERR(fep->clk_ptp))
-		clk_disable_unprepare(fep->clk_ptp);
+	clk_disable_unprepare(fep->clk_ptp);
 failed_pin:
 failed_clk:
 	iounmap(fep->hwp);
-- 
1.7.9.5

  reply	other threads:[~2013-03-18  8:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18  8:26 [PATCH v2 0/4] ARM: mxs: sanitize enet_out clock handling Shawn Guo
2013-03-18  8:26 ` Shawn Guo [this message]
2013-03-18  8:26 ` [PATCH v2 2/4] net: freescale: fec: add support for optional enet_out clk Shawn Guo
2013-03-18  8:26 ` [PATCH v2 3/4] ARM: dts: mxs: add enet_out clock to devicetree Shawn Guo
2013-03-18  8:26 ` [PATCH v2 4/4] ARM: mxs: remove unneeded enet_out clk initialization Shawn Guo
2013-03-18 16:57 ` [PATCH v2 0/4] ARM: mxs: sanitize enet_out clock handling David Miller

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=1363595185-12302-2-git-send-email-shawn.guo@linaro.org \
    --to=shawn.guo@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).