Message ID | 20191016031107.30045-1-natechancellor@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [-next,v2] arm64: mm: Fix unused variable warning in zone_sizes_init | expand |
On Tue, 2019-10-15 at 20:11 -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> > --- > > v1 -> v2: > > * Fix check for CONFIG_ZONE_DMA32 as pointed out by Will. > > 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..359c3b08b968 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_DMA32) > unsigned long max_dma = min; > +#endif > > memset(zone_size, 0, sizeof(zone_size)); > Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Thanks!
On Tue, Oct 15, 2019 at 08:11:08PM -0700, Nathan Chancellor wrote: > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c > index 44f07fdf7a59..359c3b08b968 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_DMA32) > unsigned long max_dma = min; > +#endif Nitpick: the coding style recommends __maybe_unused instead of #ifdef.
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 44f07fdf7a59..359c3b08b968 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_DMA32) unsigned long max_dma = min; +#endif memset(zone_size, 0, sizeof(zone_size));
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> --- v1 -> v2: * Fix check for CONFIG_ZONE_DMA32 as pointed out by Will. arch/arm64/mm/init.c | 2 ++ 1 file changed, 2 insertions(+)