diff mbox series

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

Message ID 20191015224304.20963-1-natechancellor@gmail.com (mailing list archive)
State New, archived
Headers show
Series [-next] arm64: mm: Fix unused variable warning in zone_sizes_init | expand

Commit Message

Nathan Chancellor Oct. 15, 2019, 10:43 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 an ifdef around the variable to fix this.

Fixes: 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
 arch/arm64/mm/init.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Will Deacon Oct. 16, 2019, 3 a.m. UTC | #1
On Tue, Oct 15, 2019 at 03:43:04PM -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 an ifdef around the variable to fix this.
> 
> Fixes: 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>  arch/arm64/mm/init.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> index 44f07fdf7a59..c3d6657b9942 100644
> --- a/arch/arm64/mm/init.c
> +++ b/arch/arm64/mm/init.c
> @@ -212,7 +212,9 @@ 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;
> +#if defined(CONFIG_ZONE_DMA) || defined(CONFIG_ZONE_DMA)
>  	unsigned long max_dma = min;
> +#endif

This looks bogus to me :/ You're referring to CONFIG_ZONE_DMA twice, and I
can't see how that symbol even exists on arm64.

Will
Nathan Chancellor Oct. 16, 2019, 3:08 a.m. UTC | #2
On Wed, Oct 16, 2019 at 04:00:52AM +0100, Will Deacon wrote:
> On Tue, Oct 15, 2019 at 03:43:04PM -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 an ifdef around the variable to fix this.
> > 
> > Fixes: 1a8e1cef7603 ("arm64: use both ZONE_DMA and ZONE_DMA32")
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >  arch/arm64/mm/init.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> > index 44f07fdf7a59..c3d6657b9942 100644
> > --- a/arch/arm64/mm/init.c
> > +++ b/arch/arm64/mm/init.c
> > @@ -212,7 +212,9 @@ 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;
> > +#if defined(CONFIG_ZONE_DMA) || defined(CONFIG_ZONE_DMA)
> >  	unsigned long max_dma = min;
> > +#endif
> 
> This looks bogus to me :/ You're referring to CONFIG_ZONE_DMA twice, and I
> can't see how that symbol even exists on arm64.
> 
> Will

Gah, sorry, one of those CONFIGs should be CONFIG_ZONE_DMA32. I will
send a v2 to fix that shortly.

Note, this patch is targetting for-next/zone-dma, which reintroduces
CONFIG_ZONE_DMA. Sorry if the patch tag and Fixes tag didn't make that
clear, let me know how I can better convey that in the future!

Cheers,
Nathan
diff mbox series

Patch

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 44f07fdf7a59..c3d6657b9942 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -212,7 +212,9 @@  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;
+#if defined(CONFIG_ZONE_DMA) || defined(CONFIG_ZONE_DMA)
 	unsigned long max_dma = min;
+#endif
 
 	memset(zone_size, 0, sizeof(zone_size));