linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Minghuan Lian <minghuan.Lian@freescale.com>,
	Mingkai Hu <mingkai.hu@freescale.com>,
	Roy Zang <tie-fei.zang@freescale.com>,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: layerscape: Fix drvdata usage before assignment
Date: Mon, 17 Oct 2016 08:01:45 -0500	[thread overview]
Message-ID: <20161017130145.GB18903@localhost> (raw)
In-Reply-To: <1476700772-18745-1-git-send-email-marc.zyngier@arm.com>

On Mon, Oct 17, 2016 at 11:39:32AM +0100, Marc Zyngier wrote:
> Commit fefe6733e516 ("PCI: layerscape: Move struct pcie_port setup
> to probe function") changed the init ordering of the pcie structure,
> but started to use the pcie->drvdata field before initializing it.
> Mayhem follows.
> 
> Fix this by moving the drvdata assignment right before the first use.
> Tested on LS2085a.
> 
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

Applied to for-linus for v4.9, thanks, Marc!

> ---
>  drivers/pci/host/pci-layerscape.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c
> index 856d428..27602a3 100644
> --- a/drivers/pci/host/pci-layerscape.c
> +++ b/drivers/pci/host/pci-layerscape.c
> @@ -270,6 +270,7 @@ static int __init ls_pcie_probe(struct platform_device *pdev)
>  
>  	pp = &pcie->pp;
>  	pp->dev = dev;
> +	pcie->drvdata = match->data;
>  	pp->ops = pcie->drvdata->ops;
>  
>  	dbi_base = platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
> @@ -279,7 +280,6 @@ static int __init ls_pcie_probe(struct platform_device *pdev)
>  		return PTR_ERR(pcie->pp.dbi_base);
>  	}
>  
> -	pcie->drvdata = match->data;
>  	pcie->lut = pcie->pp.dbi_base + pcie->drvdata->lut_offset;
>  
>  	if (!ls_pcie_is_bridge(pcie))
> -- 
> 2.1.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2016-10-17 13:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 10:39 [PATCH] PCI: layerscape: Fix drvdata usage before assignment Marc Zyngier
2016-10-17 13:01 ` Bjorn Helgaas [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=20161017130145.GB18903@localhost \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=minghuan.Lian@freescale.com \
    --cc=mingkai.hu@freescale.com \
    --cc=tie-fei.zang@freescale.com \
    /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;
as well as URLs for NNTP newsgroup(s).