diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2017-04-24 17:34:20 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-26 05:38:56 -0400 |
commit | d721f9bbe6a7d9543f560053f8be5237e7db18e9 (patch) | |
tree | ef87e8fa5e5887027e1225eb832e2d7a1b186f7e /drivers/fpga/altera-hps2fpga.c | |
parent | 139752a210544dd02bac5c21322751de300ece93 (diff) |
fpga altera-hps2fpga: disable/unprepare clock on error in alt_fpga_bridge_probe()
If either _alt_hps2fpga_enable_set() or fpga_bridge_register() fail in
alt_fpga_bridge_probe(), the clock remains enabled and prepared. Also,
in the error path for _alt_hps2fpga_enable_set() a call to
fpga_bridge_unregister() is made even though the bridge was not
registered yet.
Remove the unnecessary call to fpga_bridge_unregister() and call
clk_disable_unprepare() in both error paths in order to make sure the
clock gets properly disabled and unprepared.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Alan Tull <atull@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/fpga/altera-hps2fpga.c')
-rw-r--r-- | drivers/fpga/altera-hps2fpga.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/fpga/altera-hps2fpga.c b/drivers/fpga/altera-hps2fpga.c index 4b354c79be31..3066b805f2d0 100644 --- a/drivers/fpga/altera-hps2fpga.c +++ b/drivers/fpga/altera-hps2fpga.c | |||
@@ -181,15 +181,18 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev) | |||
181 | (enable ? "enabling" : "disabling")); | 181 | (enable ? "enabling" : "disabling")); |
182 | 182 | ||
183 | ret = _alt_hps2fpga_enable_set(priv, enable); | 183 | ret = _alt_hps2fpga_enable_set(priv, enable); |
184 | if (ret) { | 184 | if (ret) |
185 | fpga_bridge_unregister(&pdev->dev); | 185 | goto err; |
186 | return ret; | ||
187 | } | ||
188 | } | 186 | } |
189 | } | 187 | } |
190 | 188 | ||
191 | return fpga_bridge_register(dev, priv->name, &altera_hps2fpga_br_ops, | 189 | ret = fpga_bridge_register(dev, priv->name, &altera_hps2fpga_br_ops, |
192 | priv); | 190 | priv); |
191 | err: | ||
192 | if (ret) | ||
193 | clk_disable_unprepare(priv->clk); | ||
194 | |||
195 | return ret; | ||
193 | } | 196 | } |
194 | 197 | ||
195 | static int alt_fpga_bridge_remove(struct platform_device *pdev) | 198 | static int alt_fpga_bridge_remove(struct platform_device *pdev) |