devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Samuel Dionne-Riel <samuel@dionne-riel.com>
Cc: Marc Zyngier <maz@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Rob Herring <robh@kernel.org>,
	devicetree@vger.kernel.org, Frank Rowand <frowand.list@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Boot failure on gru-scarlet-inx with 5.9-rc2
Date: Thu, 3 Sep 2020 10:19:01 +0100	[thread overview]
Message-ID: <20200903091901.GA9386@e121166-lin.cambridge.arm.com> (raw)
In-Reply-To: <20200902234756.60e4c4f6@DUFFMAN>

On Wed, Sep 02, 2020 at 11:47:56PM -0400, Samuel Dionne-Riel wrote:
> On Wed, 2 Sep 2020 17:01:19 +0100
> Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:
> 
> > On Tue, Sep 01, 2020 at 02:33:56PM -0400, Samuel Dionne-Riel wrote:
> > 
> > Please print a pointer as a pointer and print both bus and
> > bus->parent.
> 
> Hopefully pointer as a pointer is %px. Not sure what else, if that's
> wrong please tell.
> 
> ---
> @@ -79,6 +79,8 @@ static int rockchip_pcie_valid_device(struct rockchip_pcie *rockchip,
>          * do not read more than one device on the bus directly attached
>          * to RC's downstream side.
>          */
> +       printk("[!!] // bus (%px) bus->parent (%px)\n", bus, bus->parent);
> +       printk("[!!] bus->primary (%d) == rockchip->root_bus_nr (%d) && dev (%d) > 0\n", bus->primary, rockchip->root_bus_nr, dev);
>         if (bus->primary == rockchip->root_bus_nr && dev > 0)
>                 return 0;
>  
> --
> 
> Again, two values, verified with a bit of set and `sort -u`.
> 
> [    1.691266] [!!] // bus (ffff0000ef9ab800) bus->parent (0000000000000000)
> [    1.691271] [!!] bus->primary (0) == rockchip->root_bus_nr (0) && dev (0) > 0
> 
> and
> 
> [    1.697156] [!!] // bus (ffff0000ef9ac000) bus->parent (ffff0000ef9ab800)
> [    1.697160] [!!] bus->primary (0) == rockchip->root_bus_nr (0) && dev (0) > 0
> 
> First instance of each shown here. Last time I don't think it was.

Ok I think I understand what the problem is.

Can you give this patch a shot please ? I think we are dereferencing
a NULL pointer if bus is the root bus and dev == 0, we can rewrite
the check if this patch fixes the issue.

-- >8 --
diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c
index 0bb2fb3e8a0b..72beda87b47f 100644
--- a/drivers/pci/controller/pcie-rockchip-host.c
+++ b/drivers/pci/controller/pcie-rockchip-host.c
@@ -79,7 +79,7 @@ static int rockchip_pcie_valid_device(struct rockchip_pcie *rockchip,
 	 * do not read more than one device on the bus directly attached
 	 * to RC's downstream side.
 	 */
-	if (pci_is_root_bus(bus->parent) && dev > 0)
+	if (bus->parent && pci_is_root_bus(bus->parent) && dev > 0)
 		return 0;
 
 	return 1;

  reply	other threads:[~2020-09-03  9:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-29 20:54 Boot failure on gru-scarlet-inx with 5.9-rc2 Samuel Dionne-Riel
2020-08-30  9:41 ` Marc Zyngier
2020-08-30 20:19   ` Samuel Dionne-Riel
2020-08-31  7:18   ` Samuel Dionne-Riel
2020-08-31  9:27     ` Marc Zyngier
2020-09-01  3:45       ` Samuel Dionne-Riel
2020-09-01 15:37         ` Marc Zyngier
2020-09-01 16:42           ` Lorenzo Pieralisi
2020-09-01 18:33             ` Samuel Dionne-Riel
2020-09-02 16:01               ` Lorenzo Pieralisi
2020-09-03  3:47                 ` Samuel Dionne-Riel
2020-09-03  9:19                   ` Lorenzo Pieralisi [this message]
2020-09-03 14:35                     ` Rob Herring
2020-09-03 15:59                       ` Marc Zyngier
2020-09-03 19:21                         ` Samuel Dionne-Riel

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=20200903091901.GA9386@e121166-lin.cambridge.arm.com \
    --to=lorenzo.pieralisi@arm.com \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=robh@kernel.org \
    --cc=samuel@dionne-riel.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).