diff mbox series

[U-Boot] armv8: fsl-layerscape: fix hwconfig and prefetching

Message ID 20191021203702.26739-1-michael@walle.cc
State Not Applicable
Delegated to: Priyanka Jain
Headers show
Series [U-Boot] armv8: fsl-layerscape: fix hwconfig and prefetching | expand

Commit Message

Michael Walle Oct. 21, 2019, 8:37 p.m. UTC
If CONFIG_HWCONFIG is disabled, hwconfig_subarg_f() will return the
empty string, ie. not NULL. Therefore, we have to check the returned
argument length as well as the return value.

Signed-off-by: Michael Walle <michael@walle.cc>
---
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Priyanka Jain Nov. 5, 2019, 10:23 a.m. UTC | #1
>-----Original Message-----
>From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Michael Walle
>Sent: Tuesday, October 22, 2019 2:07 AM
>To: u-boot@lists.denx.de
>Cc: Tom Rini <trini@konsulko.com>
>Subject: [U-Boot] [PATCH] armv8: fsl-layerscape: fix hwconfig and prefetching
>
>If CONFIG_HWCONFIG is disabled, hwconfig_subarg_f() will return the empty
>string, ie. not NULL. Therefore, we have to check the returned argument
>length as well as the return value.
>
>Signed-off-by: Michael Walle <michael@walle.cc>
>---
> arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>index a5d0b5370f..4bb73b524c 100644
>--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>@@ -1073,7 +1073,7 @@ static void config_core_prefetch(void)
> 	prefetch_arg = hwconfig_subarg_f("core_prefetch", "disable",
> 					 &arglen, buf);
>
>-	if (prefetch_arg) {
>+	if (arglen && prefetch_arg) {
> 		mask = simple_strtoul(prefetch_arg, NULL, 0) & 0xff;
> 		if (mask & 0x1) {
> 			printf("Core0 prefetch can't be disabled\n");
>--
>2.20.1
>
Please check similar patch at http://patchwork.ozlabs.org/patch/1187188/
Does this solve your issue?
--priyankajain
Michael Walle Nov. 5, 2019, 10:32 p.m. UTC | #2
Am 2019-11-05 11:23, schrieb Priyanka Jain:
>> -----Original Message-----
>> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Michael Walle
>> Sent: Tuesday, October 22, 2019 2:07 AM
>> To: u-boot@lists.denx.de
>> Cc: Tom Rini <trini@konsulko.com>
>> Subject: [U-Boot] [PATCH] armv8: fsl-layerscape: fix hwconfig and 
>> prefetching
>> 
>> If CONFIG_HWCONFIG is disabled, hwconfig_subarg_f() will return the 
>> empty
>> string, ie. not NULL. Therefore, we have to check the returned 
>> argument
>> length as well as the return value.
>> 
>> Signed-off-by: Michael Walle <michael@walle.cc>
>> ---
>> arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>> b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>> index a5d0b5370f..4bb73b524c 100644
>> --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>> +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>> @@ -1073,7 +1073,7 @@ static void config_core_prefetch(void)
>> 	prefetch_arg = hwconfig_subarg_f("core_prefetch", "disable",
>> 					 &arglen, buf);
>> 
>> -	if (prefetch_arg) {
>> +	if (arglen && prefetch_arg) {
>> 		mask = simple_strtoul(prefetch_arg, NULL, 0) & 0xff;
>> 		if (mask & 0x1) {
>> 			printf("Core0 prefetch can't be disabled\n");
>> --
>> 2.20.1
>> 
> Please check similar patch at 
> http://patchwork.ozlabs.org/patch/1187188/
> Does this solve your issue?

Yes that works, too. So my patch can be dropped.

Thanks,
-michael
Tom Rini Nov. 7, 2019, 10:22 p.m. UTC | #3
On Tue, Nov 05, 2019 at 11:32:05PM +0100, Michael Walle wrote:
> Am 2019-11-05 11:23, schrieb Priyanka Jain:
> > > -----Original Message-----
> > > From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Michael Walle
> > > Sent: Tuesday, October 22, 2019 2:07 AM
> > > To: u-boot@lists.denx.de
> > > Cc: Tom Rini <trini@konsulko.com>
> > > Subject: [U-Boot] [PATCH] armv8: fsl-layerscape: fix hwconfig and
> > > prefetching
> > > 
> > > If CONFIG_HWCONFIG is disabled, hwconfig_subarg_f() will return the
> > > empty
> > > string, ie. not NULL. Therefore, we have to check the returned
> > > argument
> > > length as well as the return value.
> > > 
> > > Signed-off-by: Michael Walle <michael@walle.cc>
> > > ---
> > > arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
> > > b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
> > > index a5d0b5370f..4bb73b524c 100644
> > > --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
> > > +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
> > > @@ -1073,7 +1073,7 @@ static void config_core_prefetch(void)
> > > 	prefetch_arg = hwconfig_subarg_f("core_prefetch", "disable",
> > > 					 &arglen, buf);
> > > 
> > > -	if (prefetch_arg) {
> > > +	if (arglen && prefetch_arg) {
> > > 		mask = simple_strtoul(prefetch_arg, NULL, 0) & 0xff;
> > > 		if (mask & 0x1) {
> > > 			printf("Core0 prefetch can't be disabled\n");
> > > --
> > > 2.20.1
> > > 
> > Please check similar patch at http://patchwork.ozlabs.org/patch/1187188/
> > Does this solve your issue?
> 
> Yes that works, too. So my patch can be dropped.

Please reply to that thread with a Tested-by as well, if you like,
thanks!
diff mbox series

Patch

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index a5d0b5370f..4bb73b524c 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -1073,7 +1073,7 @@  static void config_core_prefetch(void)
 	prefetch_arg = hwconfig_subarg_f("core_prefetch", "disable",
 					 &arglen, buf);
 
-	if (prefetch_arg) {
+	if (arglen && prefetch_arg) {
 		mask = simple_strtoul(prefetch_arg, NULL, 0) & 0xff;
 		if (mask & 0x1) {
 			printf("Core0 prefetch can't be disabled\n");