diff mbox series

xen/balloon: fix unused-variable warning

Message ID 20211108111408.3940366-1-arnd@kernel.org (mailing list archive)
State Accepted
Commit 501586ea5974a9dafee41f54a66326addb01a5ac
Headers show
Series xen/balloon: fix unused-variable warning | expand

Commit Message

Arnd Bergmann Nov. 8, 2021, 11:14 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

In configurations with CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=n
and CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=y, gcc warns about an
unused variable:

drivers/xen/balloon.c:83:12: error: 'xen_hotplug_unpopulated' defined but not used [-Werror=unused-variable]

Since this is always zero when CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
is disabled, turn it into a preprocessor constant in that case.

Fixes: 121f2faca2c0 ("xen/balloon: rename alloc/free_xenballooned_pages")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/xen/balloon.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Jürgen Groß Nov. 8, 2021, 4:24 p.m. UTC | #1
On 08.11.21 12:14, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> In configurations with CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=n
> and CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=y, gcc warns about an
> unused variable:
> 
> drivers/xen/balloon.c:83:12: error: 'xen_hotplug_unpopulated' defined but not used [-Werror=unused-variable]
> 
> Since this is always zero when CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
> is disabled, turn it into a preprocessor constant in that case.
> 
> Fixes: 121f2faca2c0 ("xen/balloon: rename alloc/free_xenballooned_pages")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen
Boris Ostrovsky Nov. 9, 2021, 1:30 p.m. UTC | #2
On 11/8/21 6:14 AM, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> In configurations with CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=n
> and CONFIG_XEN_BALLOON_MEMORY_HOTPLUG=y, gcc warns about an
> unused variable:
>
> drivers/xen/balloon.c:83:12: error: 'xen_hotplug_unpopulated' defined but not used [-Werror=unused-variable]
>
> Since this is always zero when CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
> is disabled, turn it into a preprocessor constant in that case.
>
> Fixes: 121f2faca2c0 ("xen/balloon: rename alloc/free_xenballooned_pages")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>



Applied to for-linus-5.16b


-boris
diff mbox series

Patch

diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index ad9ba1e97450..ba2ea11e0d3d 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -80,9 +80,8 @@ 
 static uint __read_mostly balloon_boot_timeout = 180;
 module_param(balloon_boot_timeout, uint, 0444);
 
-static int xen_hotplug_unpopulated;
-
 #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
+static int xen_hotplug_unpopulated;
 
 static struct ctl_table balloon_table[] = {
 	{
@@ -115,6 +114,8 @@  static struct ctl_table xen_root[] = {
 	{ }
 };
 
+#else
+#define xen_hotplug_unpopulated 0
 #endif
 
 /*