[2/4] batman-adv: compat: fix warning in hard-interface.c for < 4.0

Message ID 20170122204043.29668-2-linus.luessing@c0d3.blue (mailing list archive)
State Accepted, archived
Commit 7c212678ca1f67de552b2dfc74e3ce8cfc55dd72
Delegated to: Sven Eckelmann
Headers

Commit Message

Linus Lüssing Jan. 22, 2017, 8:40 p.m. UTC
  This fixes the following warning:

hard-interface.c:104:39: warning: incorrect type in return expression (different base types)
hard-interface.c:104:39:    expected struct net *
hard-interface.c:104:39:    got bool

Which allows compiling with -Werror again on kernels < 4.0.

Fixes: bea804dbde21 ("batman-adv: Handle parent interfaces in a different netns")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
---
 compat.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/compat.h b/compat.h
index 8e23911..8628cf5 100644
--- a/compat.h
+++ b/compat.h
@@ -153,8 +153,8 @@  static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
 
-/* WARNING for batadv_getlink_net */
-#define get_link_net get_xstats_size || 1 || netdev->rtnl_link_ops->get_xstats_size
+/* wild hack for batadv_getlink_net only */
+#define get_link_net get_xstats_size || 1 ? fallback_net : (struct net*)netdev->rtnl_link_ops->get_xstats_size
 
 #endif /* < KERNEL_VERSION(4, 0, 0) */