aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/fpga/ice40-spi.c
diff options
context:
space:
mode:
authorAlan Tull <atull@kernel.org>2018-10-15 18:20:01 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-16 05:13:50 -0400
commit084181fe8cc7472695b907f0018f4cd00934cb12 (patch)
tree812b6c10de92d91bccfdec2da621abacc2745c4d /drivers/fpga/ice40-spi.c
parent1c87dc897b8c8ace3aa4480fa29ef6439dabb3ab (diff)
fpga: mgr: add devm_fpga_mgr_create
Add devm_fpga_mgr_create() which is the managed version of fpga_mgr_create(). Change current FPGA manager drivers to use devm_fpga_mgr_create() Signed-off-by: Alan Tull <atull@kernel.org> Suggested-by: Federico Vaga <federico.vaga@cern.ch> Acked-by: Moritz Fischer <mdf@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/fpga/ice40-spi.c')
-rw-r--r--drivers/fpga/ice40-spi.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/fpga/ice40-spi.c b/drivers/fpga/ice40-spi.c
index 5981c7ee7a7d..6154661b8f76 100644
--- a/drivers/fpga/ice40-spi.c
+++ b/drivers/fpga/ice40-spi.c
@@ -175,18 +175,14 @@ static int ice40_fpga_probe(struct spi_device *spi)
175 return ret; 175 return ret;
176 } 176 }
177 177
178 mgr = fpga_mgr_create(dev, "Lattice iCE40 FPGA Manager", 178 mgr = devm_fpga_mgr_create(dev, "Lattice iCE40 FPGA Manager",
179 &ice40_fpga_ops, priv); 179 &ice40_fpga_ops, priv);
180 if (!mgr) 180 if (!mgr)
181 return -ENOMEM; 181 return -ENOMEM;
182 182
183 spi_set_drvdata(spi, mgr); 183 spi_set_drvdata(spi, mgr);
184 184
185 ret = fpga_mgr_register(mgr); 185 return fpga_mgr_register(mgr);
186 if (ret)
187 fpga_mgr_free(mgr);
188
189 return ret;
190} 186}
191 187
192static int ice40_fpga_remove(struct spi_device *spi) 188static int ice40_fpga_remove(struct spi_device *spi)