diff mbox

[1/1] of/fdt: simplify early_init_dt_verify

Message ID 1414497065-9808-1-git-send-email-thunder.leizhen@huawei.com
State New
Headers show

Commit Message

Leizhen (ThunderTown) Oct. 28, 2014, 11:51 a.m. UTC
put off initial_boot_params = params; until all checks finished. If any check
failed, initial_boot_params is equal NULL, base upon bss segment initial value.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/of/fdt.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

--
1.8.0


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Grant Likely Nov. 4, 2014, 4:20 p.m. UTC | #1
On Tue, 28 Oct 2014 19:51:05 +0800
, Zhen Lei <thunder.leizhen@huawei.com>
 wrote:
> put off initial_boot_params = params; until all checks finished. If any check
> failed, initial_boot_params is equal NULL, base upon bss segment initial value.
> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>

Interesting. I received exactly the same patch from Bjorn Helgaas. Were
the two of you working together, or is this merely a coincedence?

g.

> ---
>  drivers/of/fdt.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index d1ffca8..325c638 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -994,14 +994,12 @@ bool __init early_init_dt_verify(void *params)
>  	if (!params)
>  		return false;
> 
> -	/* Setup flat device-tree pointer */
> -	initial_boot_params = params;
> -
>  	/* check device tree validity */
> -	if (fdt_check_header(params)) {
> -		initial_boot_params = NULL;
> +	if (fdt_check_header(params))
>  		return false;
> -	}
> +
> +	/* Setup flat device-tree pointer */
> +	initial_boot_params = params;
> 
>  	return true;
>  }
> --
> 1.8.0
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bjorn Helgaas Nov. 4, 2014, 5:03 p.m. UTC | #2
On Tue, Nov 4, 2014 at 9:20 AM, Grant Likely <grant.likely@linaro.org> wrote:
> On Tue, 28 Oct 2014 19:51:05 +0800
> , Zhen Lei <thunder.leizhen@huawei.com>
>  wrote:
>> put off initial_boot_params = params; until all checks finished. If any check
>> failed, initial_boot_params is equal NULL, base upon bss segment initial value.
>>
>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>
> Interesting. I received exactly the same patch from Bjorn Helgaas. Were
> the two of you working together, or is this merely a coincedence?

LOL, that's really funny.  We're not working together, so it's a total
coincidence :)

>> ---
>>  drivers/of/fdt.c | 10 ++++------
>>  1 file changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
>> index d1ffca8..325c638 100644
>> --- a/drivers/of/fdt.c
>> +++ b/drivers/of/fdt.c
>> @@ -994,14 +994,12 @@ bool __init early_init_dt_verify(void *params)
>>       if (!params)
>>               return false;
>>
>> -     /* Setup flat device-tree pointer */
>> -     initial_boot_params = params;
>> -
>>       /* check device tree validity */
>> -     if (fdt_check_header(params)) {
>> -             initial_boot_params = NULL;
>> +     if (fdt_check_header(params))
>>               return false;
>> -     }
>> +
>> +     /* Setup flat device-tree pointer */
>> +     initial_boot_params = params;
>>
>>       return true;
>>  }
>> --
>> 1.8.0
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Leizhen (ThunderTown) Nov. 5, 2014, 12:49 a.m. UTC | #3
On 2014/11/5 1:03, Bjorn Helgaas wrote:
> On Tue, Nov 4, 2014 at 9:20 AM, Grant Likely <grant.likely@linaro.org> wrote:
>> On Tue, 28 Oct 2014 19:51:05 +0800
>> , Zhen Lei <thunder.leizhen@huawei.com>
>>  wrote:
>>> put off initial_boot_params = params; until all checks finished. If any check
>>> failed, initial_boot_params is equal NULL, base upon bss segment initial value.
>>>
>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>>
>> Interesting. I received exactly the same patch from Bjorn Helgaas. Were
>> the two of you working together, or is this merely a coincedence?
> 
> LOL, that's really funny.  We're not working together, so it's a total
> coincidence :)
> 
Haha!!!

Hi, Bjorn Helgaas. Nice to meet you.

>>> ---
>>>  drivers/of/fdt.c | 10 ++++------
>>>  1 file changed, 4 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
>>> index d1ffca8..325c638 100644
>>> --- a/drivers/of/fdt.c
>>> +++ b/drivers/of/fdt.c
>>> @@ -994,14 +994,12 @@ bool __init early_init_dt_verify(void *params)
>>>       if (!params)
>>>               return false;
>>>
>>> -     /* Setup flat device-tree pointer */
>>> -     initial_boot_params = params;
>>> -
>>>       /* check device tree validity */
>>> -     if (fdt_check_header(params)) {
>>> -             initial_boot_params = NULL;
>>> +     if (fdt_check_header(params))
>>>               return false;
>>> -     }
>>> +
>>> +     /* Setup flat device-tree pointer */
>>> +     initial_boot_params = params;
>>>
>>>       return true;
>>>  }
>>> --
>>> 1.8.0
>>>
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>> Please read the FAQ at  http://www.tux.org/lkml/
>>
> 
> .
> 


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Grant Likely Nov. 5, 2014, 1:52 p.m. UTC | #4
On Wed, Nov 5, 2014 at 12:49 AM, leizhen <thunder.leizhen@huawei.com> wrote:
> On 2014/11/5 1:03, Bjorn Helgaas wrote:
>> On Tue, Nov 4, 2014 at 9:20 AM, Grant Likely <grant.likely@linaro.org> wrote:
>>> On Tue, 28 Oct 2014 19:51:05 +0800
>>> , Zhen Lei <thunder.leizhen@huawei.com>
>>>  wrote:
>>>> put off initial_boot_params = params; until all checks finished. If any check
>>>> failed, initial_boot_params is equal NULL, base upon bss segment initial value.
>>>>
>>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>>>
>>> Interesting. I received exactly the same patch from Bjorn Helgaas. Were
>>> the two of you working together, or is this merely a coincedence?
>>
>> LOL, that's really funny.  We're not working together, so it's a total
>> coincidence :)
>>
> Haha!!!
>
> Hi, Bjorn Helgaas. Nice to meet you.

I've applied Bjorn's version, but since the diffstat is *identical*,
I've put both of your s-o-b lines into it.

BTW Lei, what prompted you to write this patch? Was there a bug you
were fixing, or did you just notice the inconsistency and decide to
fix it?

g.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Leizhen (ThunderTown) Nov. 6, 2014, 12:59 a.m. UTC | #5
On 2014/11/5 21:52, Grant Likely wrote:
> On Wed, Nov 5, 2014 at 12:49 AM, leizhen <thunder.leizhen@huawei.com> wrote:
>> On 2014/11/5 1:03, Bjorn Helgaas wrote:
>>> On Tue, Nov 4, 2014 at 9:20 AM, Grant Likely <grant.likely@linaro.org> wrote:
>>>> On Tue, 28 Oct 2014 19:51:05 +0800
>>>> , Zhen Lei <thunder.leizhen@huawei.com>
>>>>  wrote:
>>>>> put off initial_boot_params = params; until all checks finished. If any check
>>>>> failed, initial_boot_params is equal NULL, base upon bss segment initial value.
>>>>>
>>>>> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
>>>>
>>>> Interesting. I received exactly the same patch from Bjorn Helgaas. Were
>>>> the two of you working together, or is this merely a coincedence?
>>>
>>> LOL, that's really funny.  We're not working together, so it's a total
>>> coincidence :)
>>>
>> Haha!!!
>>
>> Hi, Bjorn Helgaas. Nice to meet you.
> 
> I've applied Bjorn's version, but since the diffstat is *identical*,
> I've put both of your s-o-b lines into it.
> 
> BTW Lei, what prompted you to write this patch? Was there a bug you
> were fixing, or did you just notice the inconsistency and decide to
> fix it?
> 
> g.
> 
> .
> 
OK

The latter case. Just found it when I reading code.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index d1ffca8..325c638 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -994,14 +994,12 @@  bool __init early_init_dt_verify(void *params)
 	if (!params)
 		return false;

-	/* Setup flat device-tree pointer */
-	initial_boot_params = params;
-
 	/* check device tree validity */
-	if (fdt_check_header(params)) {
-		initial_boot_params = NULL;
+	if (fdt_check_header(params))
 		return false;
-	}
+
+	/* Setup flat device-tree pointer */
+	initial_boot_params = params;

 	return true;
 }