diff mbox series

[added,to,the,4.1,stable,tree] ipv4: ipconfig: avoid unused ic_proto_used symbol

Message ID 20180301152116.1486-469-alexander.levin@microsoft.com
State New
Headers show
Series [added,to,the,4.1,stable,tree] ipv4: ipconfig: avoid unused ic_proto_used symbol | expand

Commit Message

Sasha Levin March 1, 2018, 3:27 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>


This patch has been added to the 4.1 stable tree. If you have any
objections, please let us know.

-- 
2.14.1
diff mbox series

Patch

===============

[ Upstream commit 52b79e2bdf92b07b37c805c50811eaf69a33683d ]

When CONFIG_PROC_FS, CONFIG_IP_PNP_BOOTP, CONFIG_IP_PNP_DHCP and
CONFIG_IP_PNP_RARP are all disabled, we get a warning about the
ic_proto_used variable being unused:

net/ipv4/ipconfig.c:146:12: error: 'ic_proto_used' defined but not used [-Werror=unused-variable]

This avoids the warning, by making the definition conditional on
whether a dynamic IP configuration protocol is configured. If not,
we know that the value is always zero, so we can optimize away the
variable and all code that depends on it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
---
 net/ipv4/ipconfig.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 8e7328c6a390..6389616ccc3f 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -148,7 +148,11 @@  static char vendor_class_identifier[253] __initdata;
 
 /* Persistent data: */
 
+#ifdef IPCONFIG_DYNAMIC
 static int ic_proto_used;			/* Protocol used, if any */
+#else
+#define ic_proto_used 0
+#endif
 static __be32 ic_nameservers[CONF_NAMESERVERS_MAX]; /* DNS Server IP addresses */
 static u8 ic_domain[64];		/* DNS (not NIS) domain name */