diff mbox series

[-next,v3] arm64: mm: Fix unused variable warning in zone_sizes_init

Message ID 20191016144713.23792-1-natechancellor@gmail.com (mailing list archive)
State Mainlined
Commit 4399d430700d3974ed6c5a1b1380bc6527f17e99
Headers show
Series [-next,v3] arm64: mm: Fix unused variable warning in zone_sizes_init | expand

Commit Message

Nathan Chancellor Oct. 16, 2019, 2:47 p.m. UTC
When building arm64 allnoconfig, CONFIG_ZONE_DMA and CONFIG_ZONE_DMA32
get disabled so there is a warning about max_dma being unused.

../arch/arm64/mm/init.c:215:16: warning: unused variable 'max_dma'
[-Wunused-variable]
        unsigned long max_dma = min;
                      ^
1 warning generated.

Add __maybe_unused to make this clear to the compiler.

Fixes: 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---

v1 -> v2:

* Fix check for CONFIG_ZONE_DMA32 as pointed out by Will.

v2 -> v3:

* Use __maybe_unused attribute instead of preprocessor ifdefs
  to conform to section 21 of the coding style as pointed out by
  Catalin.

 arch/arm64/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Catalin Marinas Oct. 16, 2019, 3:08 p.m. UTC | #1
On Wed, Oct 16, 2019 at 07:47:14AM -0700, Nathan Chancellor wrote:
> When building arm64 allnoconfig, CONFIG_ZONE_DMA and CONFIG_ZONE_DMA32
> get disabled so there is a warning about max_dma being unused.
> 
> ../arch/arm64/mm/init.c:215:16: warning: unused variable 'max_dma'
> [-Wunused-variable]
>         unsigned long max_dma = min;
>                       ^
> 1 warning generated.
> 
> Add __maybe_unused to make this clear to the compiler.
> 
> Fixes: 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>

Thanks. Queued on top of Nicolas' patches for 5.5. I also added Nicolas'
reviewed-by from v2 as I suspect it still stands.
Nicolas Saenz Julienne Oct. 16, 2019, 3:09 p.m. UTC | #2
On Wed, 2019-10-16 at 16:08 +0100, Catalin Marinas wrote:
> On Wed, Oct 16, 2019 at 07:47:14AM -0700, Nathan Chancellor wrote:
> > When building arm64 allnoconfig, CONFIG_ZONE_DMA and CONFIG_ZONE_DMA32
> > get disabled so there is a warning about max_dma being unused.
> > 
> > ../arch/arm64/mm/init.c:215:16: warning: unused variable 'max_dma'
> > [-Wunused-variable]
> >         unsigned long max_dma = min;
> >                       ^
> > 1 warning generated.
> > 
> > Add __maybe_unused to make this clear to the compiler.
> > 
> > Fixes: 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> 
> Thanks. Queued on top of Nicolas' patches for 5.5. I also added Nicolas'
> reviewed-by from v2 as I suspect it still stands.

Yes, thanks!
Nathan Chancellor Oct. 16, 2019, 3:51 p.m. UTC | #3
On Wed, Oct 16, 2019 at 05:09:30PM +0200, Nicolas Saenz Julienne wrote:
> On Wed, 2019-10-16 at 16:08 +0100, Catalin Marinas wrote:
> > On Wed, Oct 16, 2019 at 07:47:14AM -0700, Nathan Chancellor wrote:
> > > When building arm64 allnoconfig, CONFIG_ZONE_DMA and CONFIG_ZONE_DMA32
> > > get disabled so there is a warning about max_dma being unused.
> > > 
> > > ../arch/arm64/mm/init.c:215:16: warning: unused variable 'max_dma'
> > > [-Wunused-variable]
> > >         unsigned long max_dma = min;
> > >                       ^
> > > 1 warning generated.
> > > 
> > > Add __maybe_unused to make this clear to the compiler.
> > > 
> > > Fixes: 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > 
> > Thanks. Queued on top of Nicolas' patches for 5.5. I also added Nicolas'
> > reviewed-by from v2 as I suspect it still stands.
> 
> Yes, thanks!
> 

Thank you both for reviewing the patch and picking it up!

Cheers,
Nathan
diff mbox series

Patch

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 44f07fdf7a59..71b45c58218b 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -212,7 +212,7 @@  static void __init zone_sizes_init(unsigned long min, unsigned long max)
 	struct memblock_region *reg;
 	unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
 	unsigned long max_dma32 = min;
-	unsigned long max_dma = min;
+	unsigned long __maybe_unused max_dma = min;
 
 	memset(zone_size, 0, sizeof(zone_size));