diff options
author | Moritz Fischer <moritz.fischer@ettus.com> | 2015-10-22 11:56:09 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-10-23 16:49:44 -0700 |
commit | 28f98a12f7bac9c3e5ba85d245d32ec0910cf8e5 (patch) | |
tree | 41a8bc8c3da5142751b61b5a35e442704032be03 | |
parent | 92d94a7ec552fafaa036fdb04d0894d6c444cafb (diff) | |
download | linux-stable-28f98a12f7bac9c3e5ba85d245d32ec0910cf8e5.tar.gz linux-stable-28f98a12f7bac9c3e5ba85d245d32ec0910cf8e5.tar.bz2 linux-stable-28f98a12f7bac9c3e5ba85d245d32ec0910cf8e5.zip |
fpga: zynq-fpga: Fix issue with drvdata being overwritten.
Upon registering a FPGA Manager low level driver, FPGA Manager
core overwrites the platform drvdata pointer. Prior to this commit
zynq-fpga falsely relied on this pointer to still be valid at remove()
time.
Reported-by: Alan Tull <atull@opensource.altera.com>
Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com>
Acked-by: Alan Tull <atull@opensource.altera.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/fpga/zynq-fpga.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c index 31db5509f3d4..c2fb4120bd62 100644 --- a/drivers/fpga/zynq-fpga.c +++ b/drivers/fpga/zynq-fpga.c @@ -416,7 +416,6 @@ static int zynq_fpga_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - platform_set_drvdata(pdev, priv); priv->dev = dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -477,10 +476,12 @@ static int zynq_fpga_probe(struct platform_device *pdev) static int zynq_fpga_remove(struct platform_device *pdev) { struct zynq_fpga_priv *priv; + struct fpga_manager *mgr; - fpga_mgr_unregister(&pdev->dev); + mgr = platform_get_drvdata(pdev); + priv = mgr->priv; - priv = platform_get_drvdata(pdev); + fpga_mgr_unregister(&pdev->dev); clk_unprepare(priv->clk); |