* [PATCH] fpga: zynq-fpga: Fix issue with drvdata being overwritten.
2015-10-22 18:56 [PATCH] fpga: zynq-fpga: Fix issue with drvdata being overwritten Moritz Fischer
@ 2015-10-22 18:53 ` atull
0 siblings, 0 replies; 2+ messages in thread
From: atull @ 2015-10-22 18:53 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, 22 Oct 2015, Moritz Fischer wrote:
> 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>
> ---
> drivers/fpga/zynq-fpga.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c
> index 31db550..c2fb412 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);
>
Hi Moritz,
Looks good!
Acked-by: Alan Tull <atull@opensource.altera.com>
Alan
> --
> 2.6.2
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] fpga: zynq-fpga: Fix issue with drvdata being overwritten.
@ 2015-10-22 18:56 Moritz Fischer
2015-10-22 18:53 ` atull
0 siblings, 1 reply; 2+ messages in thread
From: Moritz Fischer @ 2015-10-22 18:56 UTC (permalink / raw)
To: linux-arm-kernel
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>
---
drivers/fpga/zynq-fpga.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c
index 31db550..c2fb412 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);
--
2.6.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-22 18:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-22 18:56 [PATCH] fpga: zynq-fpga: Fix issue with drvdata being overwritten Moritz Fischer
2015-10-22 18:53 ` atull
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox