Skip to contentSkip to conversation

From: Andy Shevchenko <[email protected]>

PATCH Andy Shevchenko 1 participant 2 messages Sep 16, 2025

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

clang is not happy about set but unused variable:

kernel/kexec_core.c:745:16: error: variable 'maddr' set but not used [-Werror,-Wunused-but-set-variable]
745 | unsigned long maddr;
| ^
1 error generated.

Fix the compilation breakage (make W=1 build) by removing unused variable.

As Nathan noted, GCC 16 produces the similar warning;

Fixes f4fecb50d6e1 ("kexec_core: remove superfluous page offset handling in segment loading")

---

v2: fixed Fixes (Nathan), added a note about GCC (Nathan), added tag (Nathan)

 kernel/kexec_core.c | 3 ---
 1 file changed, 3 deletions(-)
kernel/kexec_core.c +0 -3
index 5357ed39e9d1..32722926bc7e 100644
@@ -742,7 +742,6 @@ static int kimage_load_cma_segment(struct kimage *image, int idx)
 	struct kexec_segment *segment = &image->segment[idx];
 	struct page *cma = image->segment_cma[idx];
 	char *ptr = page_address(cma);
-	unsigned long maddr;
 	size_t ubytes, mbytes;
 	int result = 0;
 	unsigned char __user *buf = NULL;
@@ -754,7 +753,6 @@ static int kimage_load_cma_segment(struct kimage *image, int idx)
 		buf = segment->buf;
 	ubytes = segment->bufsz;
 	mbytes = segment->memsz;
-	maddr = segment->mem;
 
 	/* Then copy from source buffer to the CMA one */
 	while (mbytes) {
@@ -782,7 +780,6 @@ static int kimage_load_cma_segment(struct kimage *image, int idx)
 		}
 
 		ptr    += mchunk;
-		maddr  += mchunk;
 		mbytes -= mchunk;
 
 		cond_resched();
Signature · 1 line
2.50.1
#1 lore raw

On Tue, Sep 16, 2025 at 02:29:49PM +0200, Andy Shevchenko wrote:

My gosh, the Subject is mangled, sorry, I resend it ASAP after double checking it's fine looking.

Signature · 2 lines
With Best Regards,
Andy Shevchenko