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>
This commit is contained in:
Moritz Fischer 2015-10-22 11:56:09 -07:00 коммит произвёл Greg Kroah-Hartman
Родитель 92d94a7ec5
Коммит 28f98a12f7
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -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,11 +476,13 @@ 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;
mgr = platform_get_drvdata(pdev);
priv = mgr->priv;
fpga_mgr_unregister(&pdev->dev);
priv = platform_get_drvdata(pdev);
clk_unprepare(priv->clk);
return 0;