From: James Hogan <james.hogan@imgtec.com>
To: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>,
devicetree@vger.kernel.org, linux-arch@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] of: unflatten_and_copy: handle NULL initial_boot_params
Date: Thu, 21 Nov 2013 13:33:46 +0000 [thread overview]
Message-ID: <528E0BBA.6050002@imgtec.com> (raw)
In-Reply-To: <20131121123927.34EAEC40A2C@trevor.secretlab.ca>
On 21/11/13 12:39, Grant Likely wrote:
> On Tue, 19 Nov 2013 12:58:12 +0000, James Hogan <james.hogan@imgtec.com> wrote:
>> Check whether initial_boot_params is NULL before dereferencing it in
>> unflatten_and_copy_device_tree() for the case where no device tree is
>> available but the arch can still boot to a minimal usable system without
>> it.
>>
>> Signed-off-by: James Hogan <james.hogan@imgtec.com>
>> Cc: Grant Likely <grant.likely@linaro.org>
>> Cc: Rob Herring <rob.herring@calxeda.com>
>> Cc: devicetree@vger.kernel.org
>> Cc: linux-arch@vger.kernel.org
>> ---
>> drivers/of/fdt.c | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
>> index 2fa024b97c43..ac4983955e6d 100644
>> --- a/drivers/of/fdt.c
>> +++ b/drivers/of/fdt.c
>> @@ -922,8 +922,14 @@ void __init unflatten_device_tree(void)
>> */
>> void __init unflatten_and_copy_device_tree(void)
>> {
>> - int size = __be32_to_cpu(initial_boot_params->totalsize);
>> - void *dt = early_init_dt_alloc_memory_arch(size,
>> + int size;
>> + void *dt;
>> +
>> + if (!initial_boot_params)
>> + return;
>
> Worth logging a message for those who can obtain the kernel log
> buffer?
Yes, sounds reasonable (especially since for Meta the platform name detected from DT doesn't get logged in this case and I still get the console out via JTAG probe).
I'll post a v2 adding this:
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ac4983955e6d..758b4f8b30b7 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -925,8 +925,10 @@ void __init unflatten_and_copy_device_tree(void)
int size;
void *dt;
- if (!initial_boot_params)
+ if (!initial_boot_params) {
+ pr_warn("No valid device tree found, continuing without\n");
return;
+ }
size = __be32_to_cpu(initial_boot_params->totalsize);
dt = early_init_dt_alloc_memory_arch(size,
> Otherwise:
>
> Acked-by: Grant Likely <grant.likely@linaro.org>
Thanks
James
WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@imgtec.com>
To: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>,
<devicetree@vger.kernel.org>, <linux-arch@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] of: unflatten_and_copy: handle NULL initial_boot_params
Date: Thu, 21 Nov 2013 13:33:46 +0000 [thread overview]
Message-ID: <528E0BBA.6050002@imgtec.com> (raw)
In-Reply-To: <20131121123927.34EAEC40A2C@trevor.secretlab.ca>
On 21/11/13 12:39, Grant Likely wrote:
> On Tue, 19 Nov 2013 12:58:12 +0000, James Hogan <james.hogan@imgtec.com> wrote:
>> Check whether initial_boot_params is NULL before dereferencing it in
>> unflatten_and_copy_device_tree() for the case where no device tree is
>> available but the arch can still boot to a minimal usable system without
>> it.
>>
>> Signed-off-by: James Hogan <james.hogan@imgtec.com>
>> Cc: Grant Likely <grant.likely@linaro.org>
>> Cc: Rob Herring <rob.herring@calxeda.com>
>> Cc: devicetree@vger.kernel.org
>> Cc: linux-arch@vger.kernel.org
>> ---
>> drivers/of/fdt.c | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
>> index 2fa024b97c43..ac4983955e6d 100644
>> --- a/drivers/of/fdt.c
>> +++ b/drivers/of/fdt.c
>> @@ -922,8 +922,14 @@ void __init unflatten_device_tree(void)
>> */
>> void __init unflatten_and_copy_device_tree(void)
>> {
>> - int size = __be32_to_cpu(initial_boot_params->totalsize);
>> - void *dt = early_init_dt_alloc_memory_arch(size,
>> + int size;
>> + void *dt;
>> +
>> + if (!initial_boot_params)
>> + return;
>
> Worth logging a message for those who can obtain the kernel log
> buffer?
Yes, sounds reasonable (especially since for Meta the platform name detected from DT doesn't get logged in this case and I still get the console out via JTAG probe).
I'll post a v2 adding this:
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index ac4983955e6d..758b4f8b30b7 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -925,8 +925,10 @@ void __init unflatten_and_copy_device_tree(void)
int size;
void *dt;
- if (!initial_boot_params)
+ if (!initial_boot_params) {
+ pr_warn("No valid device tree found, continuing without\n");
return;
+ }
size = __be32_to_cpu(initial_boot_params->totalsize);
dt = early_init_dt_alloc_memory_arch(size,
> Otherwise:
>
> Acked-by: Grant Likely <grant.likely@linaro.org>
Thanks
James
next prev parent reply other threads:[~2013-11-21 13:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-19 12:58 [PATCH] of: unflatten_and_copy: handle NULL initial_boot_params James Hogan
2013-11-19 12:58 ` James Hogan
2013-11-21 12:39 ` Grant Likely
2013-11-21 12:39 ` Grant Likely
2013-11-21 12:39 ` Grant Likely
2013-11-21 13:33 ` James Hogan [this message]
2013-11-21 13:33 ` James Hogan
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=528E0BBA.6050002@imgtec.com \
--to=james.hogan@imgtec.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rob.herring@calxeda.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 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.