Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [resend, PATCH v2 1/1] kexec: Remove unused code in kimage_load_cma_segment()
@ 2025-09-16 12:51 Andy Shevchenko
  2025-09-23 17:50 ` Justinien Bouron
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2025-09-16 12:51 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.

As Nathan noted, GCC 16 produces the similar warning;

Fixes: f4fecb50d6e1 ("kexec_core: remove superfluous page offset handling in segment loading")
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---

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

 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] 6+ messages in thread

* Re: [resend, PATCH v2 1/1] kexec: Remove unused code in kimage_load_cma_segment()
  2025-09-16 12:51 [resend, PATCH v2 1/1] kexec: Remove unused code in kimage_load_cma_segment() Andy Shevchenko
@ 2025-09-23 17:50 ` Justinien Bouron
       [not found]   ` <aO1lmNyLCVUhL_kO@smile.fi.intel.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Justinien Bouron @ 2025-09-23 17:50 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kexec, linux-kernel, llvm, Andrew Morton, Baoquan He,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Justinien Bouron

On Tue, Sep 16, 2025 at 02:51:09PM +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.
> 
> As Nathan noted, GCC 16 produces the similar warning;
> 
> Fixes: f4fecb50d6e1 ("kexec_core: remove superfluous page offset handling in segment loading")
FYI the commit this patch is fixing (i.e. f4fecb50d6e1) is going to need a
second revision as well (I haven't submitted it yet, still working on it), this
means that your "Fixes:" tag will need to be changed again, requiring a 3rd
revision.

I am not sure what is the proper way forward here. Should I:
    - Send my v2, without fixing the unused variable and then you send your v3
      with the updated "Fixes:" tag pointing to my v2.
    - OR fixing the unused variable in my v2 (i.e. "absorb" this patch in my
      v2).
In the latter case, I am not sure how I am supposed to credit the work in this
case? Do I need to add another "Signed-off-by: Andy Shevchenko" besides mine?

I'm still learning the ropes on how to contribute through the mailing list so I
would be grateful if you could share your input on what's the proper way forward
here.

Best,
Justinien
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> 
> v2: fixed Fixes (Nathan), added a note about GCC (Nathan), added tag (Nathan)
> 
>  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] 6+ messages in thread

* Re: [resend, PATCH v2 1/1] kexec: Remove unused code in kimage_load_cma_segment()
@ 2025-10-18 19:44 Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-10-18 19:44 UTC (permalink / raw)
  To: Justinien Bouron
  Cc: kexec, linux-kernel, llvm, Andrew Morton, Baoquan He,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt


On Tue, Sep 23, 2025 at 10:50:55AM -0700, Justinien Bouron wrote:
> On Tue, Sep 16, 2025 at 02:51:09PM +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.
> > 
> > As Nathan noted, GCC 16 produces the similar warning;
> > 
> > Fixes: f4fecb50d6e1 ("kexec_core: remove superfluous page offset handling in segment loading")
> FYI the commit this patch is fixing (i.e. f4fecb50d6e1) is going to need a
> second revision as well (I haven't submitted it yet, still working on it), this
> means that your "Fixes:" tag will need to be changed again, requiring a 3rd
> revision.
> 
> I am not sure what is the proper way forward here. Should I:
>     - Send my v2, without fixing the unused variable and then you send your v3
>       with the updated "Fixes:" tag pointing to my v2.
>     - OR fixing the unused variable in my v2 (i.e. "absorb" this patch in my
>       v2).

Second is the best (integrate this fix into yours v2).

> In the latter case, I am not sure how I am supposed to credit the work in this
> case? Do I need to add another "Signed-off-by: Andy Shevchenko" besides mine?

Just in the comment block (after the cutter '---' line and before the diff) in
a free words. No need for any special tags for this in such a case.

> I'm still learning the ropes on how to contribute through the mailing list so I
> would be grateful if you could share your input on what's the proper way forward
> here.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [resend, PATCH v2 1/1] kexec: Remove unused code in kimage_load_cma_segment()
       [not found]   ` <aO1lmNyLCVUhL_kO@smile.fi.intel.com>
@ 2025-10-24 13:03     ` Andy Shevchenko
  2025-10-24 15:39       ` Justinien Bouron
  2025-10-24 15:52       ` Justinien Bouron
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-10-24 13:03 UTC (permalink / raw)
  To: Justinien Bouron
  Cc: kexec, linux-kernel, llvm, Andrew Morton, Baoquan He,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt

On Mon, Oct 13, 2025 at 11:48:24PM +0300, Andy Shevchenko wrote:
> On Tue, Sep 23, 2025 at 10:50:55AM -0700, Justinien Bouron wrote:
> > On Tue, Sep 16, 2025 at 02:51:09PM +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.
> > > 
> > > As Nathan noted, GCC 16 produces the similar warning;
> > > 
> > > Fixes: f4fecb50d6e1 ("kexec_core: remove superfluous page offset handling in segment loading")
> > FYI the commit this patch is fixing (i.e. f4fecb50d6e1) is going to need a
> > second revision as well (I haven't submitted it yet, still working on it), this
> > means that your "Fixes:" tag will need to be changed again, requiring a 3rd
> > revision.
> > 
> > I am not sure what is the proper way forward here. Should I:
> >     - Send my v2, without fixing the unused variable and then you send your v3
> >       with the updated "Fixes:" tag pointing to my v2.
> >     - OR fixing the unused variable in my v2 (i.e. "absorb" this patch in my
> >       v2).
> 
> Second is the best (integrate this fix into yours v2).
> 
> > In the latter case, I am not sure how I am supposed to credit the work in this
> > case? Do I need to add another "Signed-off-by: Andy Shevchenko" besides mine?
> 
> Just in the comment block (after the cutter '---' line and before the diff) in
> a free words. No need for any special tags for this in such a case.
> 
> > I'm still learning the ropes on how to contribute through the mailing list so I
> > would be grateful if you could share your input on what's the proper way forward
> > here.

Any news, folks, please? The bug is still in Linux Next and prevents me from
building my stuff cleanly.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [resend, PATCH v2 1/1] kexec: Remove unused code in kimage_load_cma_segment()
  2025-10-24 13:03     ` Andy Shevchenko
@ 2025-10-24 15:39       ` Justinien Bouron
  2025-10-24 15:52       ` Justinien Bouron
  1 sibling, 0 replies; 6+ messages in thread
From: Justinien Bouron @ 2025-10-24 15:39 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kexec, linux-kernel, llvm, Andrew Morton, Baoquan He,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt

On Fri, Oct 24, 2025 at 03:03:05PM +0200, Andy Shevchenko wrote:
> On Mon, Oct 13, 2025 at 11:48:24PM +0300, Andy Shevchenko wrote:
> > On Tue, Sep 23, 2025 at 10:50:55AM -0700, Justinien Bouron wrote:
> > > On Tue, Sep 16, 2025 at 02:51:09PM +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.
> > > > 
> > > > As Nathan noted, GCC 16 produces the similar warning;
> > > > 
> > > > Fixes: f4fecb50d6e1 ("kexec_core: remove superfluous page offset handling in segment loading")
> > > FYI the commit this patch is fixing (i.e. f4fecb50d6e1) is going to need a
> > > second revision as well (I haven't submitted it yet, still working on it), this
> > > means that your "Fixes:" tag will need to be changed again, requiring a 3rd
> > > revision.
> > > 
> > > I am not sure what is the proper way forward here. Should I:
> > >     - Send my v2, without fixing the unused variable and then you send your v3
> > >       with the updated "Fixes:" tag pointing to my v2.
> > >     - OR fixing the unused variable in my v2 (i.e. "absorb" this patch in my
> > >       v2).
> > 
> > Second is the best (integrate this fix into yours v2).
> > 
> > > In the latter case, I am not sure how I am supposed to credit the work in this
> > > case? Do I need to add another "Signed-off-by: Andy Shevchenko" besides mine?
> > 
> > Just in the comment block (after the cutter '---' line and before the diff) in
> > a free words. No need for any special tags for this in such a case.
> > 
> > > I'm still learning the ropes on how to contribute through the mailing list so I
> > > would be grateful if you could share your input on what's the proper way forward
> > > here.
> 
> Any news, folks, please? The bug is still in Linux Next and prevents me from
> building my stuff cleanly.
I am working on sending the V3 as we speak, sorry for the delay.

Best,
Justinien Bouron
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

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

* Re: [resend, PATCH v2 1/1] kexec: Remove unused code in kimage_load_cma_segment()
  2025-10-24 13:03     ` Andy Shevchenko
  2025-10-24 15:39       ` Justinien Bouron
@ 2025-10-24 15:52       ` Justinien Bouron
  1 sibling, 0 replies; 6+ messages in thread
From: Justinien Bouron @ 2025-10-24 15:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kexec, linux-kernel, llvm, Andrew Morton, Baoquan He,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt

On Fri, Oct 24, 2025 at 03:03:05PM +0200, Andy Shevchenko wrote:
> On Mon, Oct 13, 2025 at 11:48:24PM +0300, Andy Shevchenko wrote:
> > On Tue, Sep 23, 2025 at 10:50:55AM -0700, Justinien Bouron wrote:
> > > On Tue, Sep 16, 2025 at 02:51:09PM +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.
> > > > 
> > > > As Nathan noted, GCC 16 produces the similar warning;
> > > > 
> > > > Fixes: f4fecb50d6e1 ("kexec_core: remove superfluous page offset handling in segment loading")
> > > FYI the commit this patch is fixing (i.e. f4fecb50d6e1) is going to need a
> > > second revision as well (I haven't submitted it yet, still working on it), this
> > > means that your "Fixes:" tag will need to be changed again, requiring a 3rd
> > > revision.
> > > 
> > > I am not sure what is the proper way forward here. Should I:
> > >     - Send my v2, without fixing the unused variable and then you send your v3
> > >       with the updated "Fixes:" tag pointing to my v2.
> > >     - OR fixing the unused variable in my v2 (i.e. "absorb" this patch in my
> > >       v2).
> > 
> > Second is the best (integrate this fix into yours v2).
> > 
> > > In the latter case, I am not sure how I am supposed to credit the work in this
> > > case? Do I need to add another "Signed-off-by: Andy Shevchenko" besides mine?
> > 
> > Just in the comment block (after the cutter '---' line and before the diff) in
> > a free words. No need for any special tags for this in such a case.
> > 
> > > I'm still learning the ropes on how to contribute through the mailing list so I
> > > would be grateful if you could share your input on what's the proper way forward
> > > here.
> 
> Any news, folks, please? The bug is still in Linux Next and prevents me from
> building my stuff cleanly.
V3 is up: https://lore.kernel.org/lkml/20251024155009.39502-1-jbouron@amazon.com/

Best,
Justinien Bouron
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

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

end of thread, other threads:[~2025-10-24 15:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-16 12:51 [resend, PATCH v2 1/1] kexec: Remove unused code in kimage_load_cma_segment() Andy Shevchenko
2025-09-23 17:50 ` Justinien Bouron
     [not found]   ` <aO1lmNyLCVUhL_kO@smile.fi.intel.com>
2025-10-24 13:03     ` Andy Shevchenko
2025-10-24 15:39       ` Justinien Bouron
2025-10-24 15:52       ` Justinien Bouron
  -- strict thread matches above, loose matches on Subject: below --
2025-10-18 19:44 Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox