public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: atull@opensource.altera.com (atull)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] fpga: zynq-fpga: Fix issue with drvdata being overwritten.
Date: Thu, 22 Oct 2015 13:53:13 -0500	[thread overview]
Message-ID: <alpine.DEB.2.02.1510221351490.14856@linuxheads99> (raw)
In-Reply-To: <1445540169-20715-1-git-send-email-moritz.fischer@ettus.com>

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
> 
> 

      reply	other threads:[~2015-10-22 18:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-22 18:56 [PATCH] fpga: zynq-fpga: Fix issue with drvdata being overwritten Moritz Fischer
2015-10-22 18:53 ` atull [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1510221351490.14856@linuxheads99 \
    --to=atull@opensource.altera.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox