From: Rob Herring <robh+dt@kernel.org>
To: Changbin Du <changbin.du@gmail.com>
Cc: 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: Wed, 24 Mar 2021 10:52:30 -0600 [thread overview]
Message-ID: <CAL_JsqJ0hyZ25jSudh3EW1Fipwbp0AzMAKXG565ZrQxn-_kBKg@mail.gmail.com> (raw)
In-Reply-To: <20210324150425.20688-1-changbin.du@gmail.com>
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?
> + return;
And the arch is supposed to just continue on oblivious that it has no DT?
> + }
> +
> __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.
>
> --
> 2.30.2
>
next prev parent reply other threads:[~2021-03-24 16:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 15:04 [PATCH] of/fdt: Check dtb pointer first in unflatten_device_tree Changbin Du
2021-03-24 16:52 ` Rob Herring [this message]
2021-03-25 16:00 ` Changbin Du
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=CAL_JsqJ0hyZ25jSudh3EW1Fipwbp0AzMAKXG565ZrQxn-_kBKg@mail.gmail.com \
--to=robh+dt@kernel.org \
--cc=changbin.du@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).