* [PATCH v1 1/1] kexec: Remove unused code in kimage_load_cma_segment()
@ 2025-09-15 15:55 Andy Shevchenko
2025-09-15 22:14 ` Nathan Chancellor
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2025-09-15 15:55 UTC (permalink / raw)
To: kexec, linux-kernel, llvm
Cc: Andrew Morton, Baoquan He, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt, Andy Shevchenko
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.
Fixes: 07d24902977e ("kexec: enable CMA based contiguous allocation")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
kernel/kexec_core.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 5357ed39e9d1..32722926bc7e 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -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();
--
2.50.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] kexec: Remove unused code in kimage_load_cma_segment()
2025-09-15 15:55 [PATCH v1 1/1] kexec: Remove unused code in kimage_load_cma_segment() Andy Shevchenko
@ 2025-09-15 22:14 ` Nathan Chancellor
2025-09-16 12:24 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2025-09-15 22:14 UTC (permalink / raw)
To: Andy Shevchenko
Cc: kexec, linux-kernel, llvm, Andrew Morton, Baoquan He,
Nick Desaulniers, Bill Wendling, Justin Stitt
Hi Andy,
On Mon, Sep 15, 2025 at 05:55:43PM +0200, Andy Shevchenko wrote:
> 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.
>
> Fixes: 07d24902977e ("kexec: enable CMA based contiguous allocation")
I don't think this fixes tag is right. maddr definitely looks used in
that diff. I think it is a follow up simplification that introduces
this.
Fixes: f4fecb50d6e1 ("kexec_core: remove superfluous page offset handling in segment loading")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
Otherwise, this patch looks correct to me and GCC 16 will warn on this
as well.
kernel/kexec_core.c: In function 'kimage_load_cma_segment':
kernel/kexec_core.c:745:23: error: variable 'maddr' set but not used [-Werror=unused-but-set-variable=]
745 | unsigned long maddr;
| ^~~~~
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> kernel/kexec_core.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
> index 5357ed39e9d1..32722926bc7e 100644
> --- a/kernel/kexec_core.c
> +++ b/kernel/kexec_core.c
> @@ -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();
> --
> 2.50.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/1] kexec: Remove unused code in kimage_load_cma_segment()
2025-09-15 22:14 ` Nathan Chancellor
@ 2025-09-16 12:24 ` Andy Shevchenko
0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2025-09-16 12:24 UTC (permalink / raw)
To: Nathan Chancellor
Cc: kexec, linux-kernel, llvm, Andrew Morton, Baoquan He,
Nick Desaulniers, Bill Wendling, Justin Stitt
On Mon, Sep 15, 2025 at 03:14:36PM -0700, Nathan Chancellor wrote:
> Hi Andy,
>
> On Mon, Sep 15, 2025 at 05:55:43PM +0200, Andy Shevchenko wrote:
> > 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.
> >
> > Fixes: 07d24902977e ("kexec: enable CMA based contiguous allocation")
>
> I don't think this fixes tag is right. maddr definitely looks used in
> that diff. I think it is a follow up simplification that introduces
> this.
>
> Fixes: f4fecb50d6e1 ("kexec_core: remove superfluous page offset handling in segment loading")
Oh, you are right!
> Otherwise, this patch looks correct to me and GCC 16 will warn on this
> as well.
>
> kernel/kexec_core.c: In function 'kimage_load_cma_segment':
> kernel/kexec_core.c:745:23: error: variable 'maddr' set but not used [-Werror=unused-but-set-variable=]
> 745 | unsigned long maddr;
> | ^~~~~
I'll add this as well to the commit message (in shorter form).
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Thank you! I'm going to send a v2 soon.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-16 12:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-15 15:55 [PATCH v1 1/1] kexec: Remove unused code in kimage_load_cma_segment() Andy Shevchenko
2025-09-15 22:14 ` Nathan Chancellor
2025-09-16 12:24 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox