Skip to contentSkip to conversation

xtensa: One function call less in bootmem_init()

PATCH In review Markus Elfring 2 participants 2 messages Jul 5, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xtensa: One function call less in bootmem_init()

From: Markus Elfring <[email protected]>
Date: Fri, 5 Jul 2019 18:33:58 +0200

Avoid an extra function call by using a ternary operator instead of a conditional statement for a setting selection.

This issue was detected by using the Coccinelle software.

---
 arch/xtensa/mm/init.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
arch/xtensa/mm/init.c +1 -4
index b51746f2b80b..79467c749416 100644
@@ -45,10 +45,7 @@ void __init bootmem_init(void)
 	 * If PHYS_OFFSET is zero reserve page at address 0:
 	 * successfull allocations should never return NULL.
 	 */
-	if (PHYS_OFFSET)
-		memblock_reserve(0, PHYS_OFFSET);
-	else
-		memblock_reserve(0, 1);
+	memblock_reserve(0, PHYS_OFFSET ? PHYS_OFFSET : 1);
 
 	early_init_fdt_scan_reserved_mem();
 

--
2.22.0

maintainer
#1 lore raw

Hi Markus,

Quoted 7 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Fri, 5 Jul 2019 18:33:58 +0200

Avoid an extra function call by using a ternary operator instead of a conditional statement for a setting selection.

Quoted 6 lines

This issue was detected by using the Coccinelle software.

---
 arch/xtensa/mm/init.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Thanks for the patch. It doesn't change generated code since PHYS_OFFSET is a build-time constant, but it's a nice cleanup. Applied to my xtensa tree.

Signature · 2 lines
Thanks.
-- Max