From: Samuel Dionne-Riel <samuel@dionne-riel.com>
To: Marc Zyngier <maz@kernel.org>
Cc: Rob Herring <robh@kernel.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>,
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 15:21:40 -0400 [thread overview]
Message-ID: <20200903152140.7b6e9c7f@DUFFMAN> (raw)
In-Reply-To: <9be6848cfdbb92865417292feff03cae@kernel.org>
On Thu, 03 Sep 2020 16:59:30 +0100
Marc Zyngier <maz@kernel.org> wrote:
> On 2020-09-03 15:35, Rob Herring wrote:
> > On Thu, Sep 3, 2020 at 3:19 AM Lorenzo Pieralisi
> > <lorenzo.pieralisi@arm.com> wrote:
> >>
> >> 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.
> >
> > Indeed. I checked all the other cases of
> > pci_is_root_bus(bus->parent) and they should be fine because they
> > are only reached if !root_bus.
> >
> > I would restructure the check like this instead:
> >
> > diff --git a/drivers/pci/controller/pcie-rockchip-host.c
> > b/drivers/pci/controller/pcie-rockchip-host.c
> > index 0bb2fb3e8a0b..9b485bea8b92 100644
> > --- a/drivers/pci/controller/pcie-rockchip-host.c
> > +++ b/drivers/pci/controller/pcie-rockchip-host.c
> > @@ -72,14 +72,14 @@ static int rockchip_pcie_valid_device(struct
> > rockchip_pcie *rockchip,
> > struct pci_bus *bus, int dev)
> > {
> > /* access only one slot on each root port */
> > - if (pci_is_root_bus(bus) && dev > 0)
> > - return 0;
> > -
> > - /*
> > - * 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 (pci_is_root_bus(bus))
> > + if (dev > 0)
> > + return 0;
> > + else if (pci_is_root_bus(bus->parent) && dev > 0)
>
> Careful here, this else is relative to the *closest* if,
> and not what the indentation suggests...
>
> > + /*
> > + * do not read more than one device on the bus
> > directly attached
> > + * to RC's downstream side.
> > + */
> > return 0;
> >
> > return 1;
>
>
> M.
Both patches work fine. They both allow the device to boot and Wi-Fi to
work as expected.
I will echo Marc's concerns over the indentation. I am only casually
acquainted with C and this indentation would bring to wrong conclusions
if it hadn't been pointed out to me.
Cc me on an eventual patch, FWIW I can give it a final test just in
case.
Thanks again,
--
Samuel Dionne-Riel
prev parent reply other threads:[~2020-09-03 19:21 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
2020-09-03 14:35 ` Rob Herring
2020-09-03 15:59 ` Marc Zyngier
2020-09-03 19:21 ` Samuel Dionne-Riel [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=20200903152140.7b6e9c7f@DUFFMAN \
--to=samuel@dionne-riel.com \
--cc=bhelgaas@google.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=maz@kernel.org \
--cc=robh@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.