From: Changbin Du <changbin.du@gmail.com>
To: Rob Herring <robh+dt@kernel.org>
Cc: Changbin Du <changbin.du@gmail.com>,
Frank Rowand <frowand.list@gmail.com>,
devicetree@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] of/fdt: Check dtb pointer first in unflatten_device_tree
Date: Thu, 25 Mar 2021 16:00:07 +0000 [thread overview]
Message-ID: <20210325155954.iun4hdcegi4b3qm2@mail.google.com> (raw)
In-Reply-To: <CAL_JsqJ0hyZ25jSudh3EW1Fipwbp0AzMAKXG565ZrQxn-_kBKg@mail.gmail.com>
On Wed, Mar 24, 2021 at 10:52:30AM -0600, Rob Herring wrote:
> On Wed, Mar 24, 2021 at 9:04 AM Changbin Du <changbin.du@gmail.com> wrote:
> >
> > The setup_arch() would invoke unflatten_device_tree() even no
> > valid fdt found. So we'd better check it first and return early.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > drivers/of/fdt.c | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> > index dcc1dd96911a..05d439d63bc5 100644
> > --- a/drivers/of/fdt.c
> > +++ b/drivers/of/fdt.c
> > @@ -1225,6 +1225,11 @@ bool __init early_init_dt_scan(void *params)
> > */
> > void __init unflatten_device_tree(void)
> > {
> > + if (!initial_boot_params) {
> > + pr_warn("No valid device tree found, continuing without\n");
>
> How are you going to see this message if you have no DT?
>
This aligns to what unflatten_and_copy_device_tree() does.
> > + return;
>
> And the arch is supposed to just continue on oblivious that it has no DT?
>
As checking the arch code(arm, riscv), I suppose so.
> > + }
> > +
> > __unflatten_device_tree(initial_boot_params, NULL, &of_root,
> > early_init_dt_alloc_memory_arch, false);
>
> Soon as you get here with a NULL initial_boot_params, you'll get a
> backtrace and halt.
>
No, we have returned before.
> >
> > --
> > 2.30.2
> >
--
Cheers,
Changbin Du
next prev parent reply other threads:[~2021-03-25 16:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 15:04 Changbin Du
2021-03-24 16:52 ` Rob Herring
2021-03-25 16:00 ` Changbin Du [this message]
2021-03-25 16:28 ` Rob Herring
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=20210325155954.iun4hdcegi4b3qm2@mail.google.com \
--to=changbin.du@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®