All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xtensa: One function call less in bootmem_init()
@ 2019-07-05 16:43 ` Markus Elfring
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2019-07-05 16:43 UTC (permalink / raw)
  To: Andrew Morton, Chris Zankel, Max Filippov, Michal Hocko, Mike Rapoport
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/xtensa/mm/init.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index b51746f2b80b..79467c749416 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] xtensa: One function call less in bootmem_init()
@ 2019-07-05 16:43 ` Markus Elfring
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2019-07-05 16:43 UTC (permalink / raw)
  To: Andrew Morton, Chris Zankel, Max Filippov, Michal Hocko, Mike Rapoport
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 arch/xtensa/mm/init.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index b51746f2b80b..79467c749416 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xtensa: One function call less in bootmem_init()
  2019-07-05 16:43 ` Markus Elfring
@ 2019-07-05 19:06   ` Max Filippov
  -1 siblings, 0 replies; 4+ messages in thread
From: Max Filippov @ 2019-07-05 19:06 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Andrew Morton, Chris Zankel, Michal Hocko, Mike Rapoport, LKML,
	kernel-janitors

Hi Markus,

On Fri, Jul 5, 2019 at 9:43 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  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.

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xtensa: One function call less in bootmem_init()
@ 2019-07-05 19:06   ` Max Filippov
  0 siblings, 0 replies; 4+ messages in thread
From: Max Filippov @ 2019-07-05 19:06 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Andrew Morton, Chris Zankel, Michal Hocko, Mike Rapoport, LKML,
	kernel-janitors

Hi Markus,

On Fri, Jul 5, 2019 at 9:43 AM Markus Elfring <Markus.Elfring@web.de> wrote:
>
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  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.

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-05 19:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-05 16:43 [PATCH] xtensa: One function call less in bootmem_init() Markus Elfring
2019-07-05 16:43 ` Markus Elfring
2019-07-05 19:06 ` Max Filippov
2019-07-05 19:06   ` Max Filippov

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.