diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2013-03-18 03:33:39 -0400 |
---|---|---|
committer | Shawn Guo <shawn.guo@linaro.org> | 2013-04-04 09:22:39 -0400 |
commit | c29dc2d771411850777eb027756b12106b5f6cd5 (patch) | |
tree | b81711c934f84e4066e1a9dcd3eebd56e6b847ee /drivers/net/ethernet/freescale/fec.c | |
parent | e933a1a12a02f42e0013cda87bba37ccb59efc47 (diff) |
net: fec: handle optional clk_ptp more gracefully
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>
Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/freescale/fec.c')
-rw-r--r-- | drivers/net/ethernet/freescale/fec.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c index 911d0253dbb2..6d965bb32908 100644 --- a/drivers/net/ethernet/freescale/fec.c +++ b/drivers/net/ethernet/freescale/fec.c | |||
@@ -1806,14 +1806,13 @@ fec_probe(struct platform_device *pdev) | |||
1806 | fep->bufdesc_ex = | 1806 | fep->bufdesc_ex = |
1807 | pdev->id_entry->driver_data & FEC_QUIRK_HAS_BUFDESC_EX; | 1807 | pdev->id_entry->driver_data & FEC_QUIRK_HAS_BUFDESC_EX; |
1808 | if (IS_ERR(fep->clk_ptp)) { | 1808 | if (IS_ERR(fep->clk_ptp)) { |
1809 | ret = PTR_ERR(fep->clk_ptp); | 1809 | fep->clk_ptp = NULL; |
1810 | fep->bufdesc_ex = 0; | 1810 | fep->bufdesc_ex = 0; |
1811 | } | 1811 | } |
1812 | 1812 | ||
1813 | clk_prepare_enable(fep->clk_ahb); | 1813 | clk_prepare_enable(fep->clk_ahb); |
1814 | clk_prepare_enable(fep->clk_ipg); | 1814 | clk_prepare_enable(fep->clk_ipg); |
1815 | if (!IS_ERR(fep->clk_ptp)) | 1815 | clk_prepare_enable(fep->clk_ptp); |
1816 | clk_prepare_enable(fep->clk_ptp); | ||
1817 | 1816 | ||
1818 | reg_phy = devm_regulator_get(&pdev->dev, "phy"); | 1817 | reg_phy = devm_regulator_get(&pdev->dev, "phy"); |
1819 | if (!IS_ERR(reg_phy)) { | 1818 | if (!IS_ERR(reg_phy)) { |
@@ -1878,8 +1877,7 @@ failed_irq: | |||
1878 | failed_regulator: | 1877 | failed_regulator: |
1879 | clk_disable_unprepare(fep->clk_ahb); | 1878 | clk_disable_unprepare(fep->clk_ahb); |
1880 | clk_disable_unprepare(fep->clk_ipg); | 1879 | clk_disable_unprepare(fep->clk_ipg); |
1881 | if (!IS_ERR(fep->clk_ptp)) | 1880 | clk_disable_unprepare(fep->clk_ptp); |
1882 | clk_disable_unprepare(fep->clk_ptp); | ||
1883 | failed_pin: | 1881 | failed_pin: |
1884 | failed_clk: | 1882 | failed_clk: |
1885 | iounmap(fep->hwp); | 1883 | iounmap(fep->hwp); |