aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/fpga/altera-hps2fpga.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/fpga/altera-hps2fpga.c')
-rw-r--r--drivers/fpga/altera-hps2fpga.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/fpga/altera-hps2fpga.c b/drivers/fpga/altera-hps2fpga.c
index 406d2f10741f..e4d39f0a7572 100644
--- a/drivers/fpga/altera-hps2fpga.c
+++ b/drivers/fpga/altera-hps2fpga.c
@@ -139,6 +139,7 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)
139 struct device *dev = &pdev->dev; 139 struct device *dev = &pdev->dev;
140 struct altera_hps2fpga_data *priv; 140 struct altera_hps2fpga_data *priv;
141 const struct of_device_id *of_id; 141 const struct of_device_id *of_id;
142 struct fpga_bridge *br;
142 u32 enable; 143 u32 enable;
143 int ret; 144 int ret;
144 145
@@ -190,11 +191,24 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev)
190 } 191 }
191 } 192 }
192 193
193 ret = fpga_bridge_register(dev, priv->name, &altera_hps2fpga_br_ops, 194 br = fpga_bridge_create(dev, priv->name, &altera_hps2fpga_br_ops, priv);
194 priv); 195 if (!br) {
195err: 196 ret = -ENOMEM;
197 goto err;
198 }
199
200 platform_set_drvdata(pdev, br);
201
202 ret = fpga_bridge_register(br);
196 if (ret) 203 if (ret)
197 clk_disable_unprepare(priv->clk); 204 goto err_free;
205
206 return 0;
207
208err_free:
209 fpga_bridge_free(br);
210err:
211 clk_disable_unprepare(priv->clk);
198 212
199 return ret; 213 return ret;
200} 214}
@@ -204,7 +218,7 @@ static int alt_fpga_bridge_remove(struct platform_device *pdev)
204 struct fpga_bridge *bridge = platform_get_drvdata(pdev); 218 struct fpga_bridge *bridge = platform_get_drvdata(pdev);
205 struct altera_hps2fpga_data *priv = bridge->priv; 219 struct altera_hps2fpga_data *priv = bridge->priv;
206 220
207 fpga_bridge_unregister(&pdev->dev); 221 fpga_bridge_unregister(bridge);
208 222
209 clk_disable_unprepare(priv->clk); 223 clk_disable_unprepare(priv->clk);
210 224