From: Fabio Estevam <festevam@gmail.com>
To: davem@davemloft.net
Cc: linux@arm.linux.org.uk, B38611@freescale.com,
netdev@vger.kernel.org,
Fabio Estevam <fabio.estevam@freescale.com>
Subject: [PATCH net-next 3/3] fec: Do not set fep->reg_phy to NULL on error
Date: Mon, 1 Sep 2014 22:12:55 -0300 [thread overview]
Message-ID: <1409620375-20284-4-git-send-email-festevam@gmail.com> (raw)
In-Reply-To: <1409620375-20284-1-git-send-email-festevam@gmail.com>
From: Fabio Estevam <fabio.estevam@freescale.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@freescale.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
next prev parent reply other threads:[~2014-09-02 1:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-02 1:12 [PATCH net-next 0/3] fec: Do not use NULL pointer to indicate error Fabio Estevam
2014-09-02 1:12 ` [PATCH net-next 1/3] fec: Do not set fep->clk_ptp to NULL on error Fabio Estevam
2014-09-02 1:12 ` [PATCH net-next 2/3] fec: Do not set fep->clk_enet_out " Fabio Estevam
2014-09-02 1:12 ` Fabio Estevam [this message]
2014-09-02 1:37 ` [PATCH net-next 0/3] fec: Do not use NULL pointer to indicate error fugang.duan
2014-09-02 20:48 ` 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=1409620375-20284-4-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=B38611@freescale.com \
--cc=davem@davemloft.net \
--cc=fabio.estevam@freescale.com \
--cc=linux@arm.linux.org.uk \
--cc=netdev@vger.kernel.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).