Skip to contentSkip to conversation

armv8: fsl-layerscape: fix hwconfig and prefetching

PATCH New Michael Walle 3 participants 4 messages Oct 21, 2019 – Nov 7, 2019 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +1 -1
index a5d0b5370f..4bb73b524c 100644
@@ -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");
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 armv8: fsl-layerscape: fix hwconfig and prefetching

Quoted 33 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Walle
Sent: Tuesday, October 22, 2019 2:07 AM
To: u-boot at lists.denx.de
Cc: Tom Rini <[email protected]>
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.

---
arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +1 -2
index a5d0b5370f..4bb73b524c 100644
@@ -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");
--
Quoted 2 lines

2.20.1

Please check similar patch at http://patchwork.ozlabs.org/patch/1187188/
Does this solve your issue?
--priyankajain

#2 lore raw

PATCH 1/1 armv8: fsl-layerscape: fix hwconfig and prefetching

Am 2019-11-05 11:23, schrieb Priyanka Jain:

Quoted 28 lines
Quoted 28 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Walle
Sent: Tuesday, October 22, 2019 2:07 AM
To: u-boot at lists.denx.de
Cc: Tom Rini <[email protected]>
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.

---
arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +0 -0
index a5d0b5370f..4bb73b524c 100644
@@ -1073,7 +1073,7 @@ static void config_core_prefetch(void)
 	prefetch_arg = hwconfig_subarg_f("core_prefetch", "disable",
 					 &arglen, buf);
 
Quoted 11 lines
Quoted 8 lines
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +1 -2
-	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

#3 lore raw

PATCH 1/1 armv8: fsl-layerscape: fix hwconfig and prefetching

Quoted 40 lines · Michael Walle

Am 2019-11-05 11:23, schrieb Priyanka Jain:

Quoted 28 lines
Quoted 28 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Michael Walle
Sent: Tuesday, October 22, 2019 2:07 AM
To: u-boot at lists.denx.de
Cc: Tom Rini <[email protected]>
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.

---
arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +0 -0
index a5d0b5370f..4bb73b524c 100644
@@ -1073,7 +1073,7 @@ static void config_core_prefetch(void)
 	prefetch_arg = hwconfig_subarg_f("core_prefetch", "disable",
 					 &arglen, buf);
 
Quoted 10 lines
Quoted 8 lines
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +1 -2
-	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?

Quoted 1 line

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!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191107/5146e108/attachment.sig>