mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sang-Heon Jeon <ekffu200098@gmail.com>
To: Chris Zankel <chris@zankel.net>, Max Filippov <jcmvbkbc@gmail.com>
Cc: Sang-Heon Jeon <ekffu200098@gmail.com>, linux-kernel@vger.kernel.org
Subject: [PATCH 4/5] xtensa: remove unreachable memblock_reserve() return value checks
Date: Wed, 17 Jun 2026 03:29:55 +0900	[thread overview]
Message-ID: <20260616182959.2429774-5-ekffu200098@gmail.com> (raw)
In-Reply-To: <20260616182959.2429774-1-ekffu200098@gmail.com>

mem_reserve() wraps memblock_reserve(), and its callers check the return
value. xtensa never calls memblock_allow_resize(), so memblock_reserve()
either succeeds or panics, never returning an error.

Therefore the return value checks are unreachable, so remove them and make
mem_reserve() return void.

No functional change.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
 arch/xtensa/kernel/setup.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index f72e280363be..c7367b81cc36 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -268,10 +268,10 @@ void __init init_arch(bp_tag_t *bp_start)
  * Initialize system. Setup memory and reserve regions.
  */
 
-static inline int __init_memblock mem_reserve(unsigned long start,
-					      unsigned long end)
+static inline void __init_memblock mem_reserve(unsigned long start,
+					       unsigned long end)
 {
-	return memblock_reserve(start, end - start);
+	memblock_reserve(start, end - start);
 }
 
 void __init setup_arch(char **cmdline_p)
@@ -290,11 +290,12 @@ void __init setup_arch(char **cmdline_p)
 	/* Reserve some memory regions */
 
 #ifdef CONFIG_BLK_DEV_INITRD
-	if (initrd_start < initrd_end &&
-	    !mem_reserve(__pa(initrd_start), __pa(initrd_end)))
+	if (initrd_start < initrd_end) {
+		mem_reserve(__pa(initrd_start), __pa(initrd_end));
 		initrd_below_start_ok = 1;
-	else
+	} else {
 		initrd_start = 0;
+	}
 #endif
 
 	mem_reserve(__pa(_stext), __pa(_end));
-- 
2.43.0


  parent reply	other threads:[~2026-06-16 18:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-16 18:29 [PATCH 0/5] treewide: remove unreachable memblock_reserve() return value checks in early boot Sang-Heon Jeon
2026-06-16 18:29 ` [PATCH 1/5] x86/setup: remove unreachable memblock_reserve() return value check Sang-Heon Jeon
2026-06-16 18:29 ` [PATCH 2/5] sh: " Sang-Heon Jeon
2026-06-16 18:29 ` [PATCH 3/5] powerpc/fadump: remove unreachable memblock_reserve() return value checks Sang-Heon Jeon
2026-06-17  9:27   ` Mukesh Kumar Chaurasiya
2026-06-16 18:29 ` Sang-Heon Jeon [this message]
2026-06-16 18:29 ` [PATCH 5/5] Revert "tpm: do not ignore memblock_reserve return value" Sang-Heon Jeon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260616182959.2429774-5-ekffu200098@gmail.com \
    --to=ekffu200098@gmail.com \
    --cc=chris@zankel.net \
    --cc=jcmvbkbc@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®