b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Simon Wunderlich <sw@simonwunderlich.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: silence smatch errors in multicast compat code
Date: Mon, 11 Nov 2013 17:33:09 +0100	[thread overview]
Message-ID: <1384187589-23259-1-git-send-email-sw@simonwunderlich.de> (raw)

smatch is reporting problems of unreachable code parts:

multicast.c:170 batadv_mcast_get_bridge() info: ignoring unreachable
code.
tmp/multicast.c:172 batadv_mcast_get_bridge() info: ignoring
unreachable code.

These are caused by compat code which returns within a loop, never
giving the rest of the function a chance to be processed. This can be
changed by slightly adjusting the compat code, setting the iterator
variable to NULL and let the original function handle the rest. This
does not introduce any functional change.

Introduced by: a3f58139efedb96222dffdda89896c243fdff49e
("batman-adv: Multicast Listener Announcements via Translation Table")

Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 compat.h |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/compat.h b/compat.h
index 186547b..a99c9d5 100644
--- a/compat.h
+++ b/compat.h
@@ -160,14 +160,12 @@ static inline int batadv_param_set_copystring(const char *val,
 #define NET_ADDR_RANDOM 0
 
 #define netdev_master_upper_dev_get_rcu(dev) \
-	upper; \
-	rcu_read_unlock(); \
+	NULL; \
 	if (dev->br_port ? 1 : 0) { \
+		rcu_read_unlock(); \
 		dev_hold(dev); \
 		return dev; \
 	} \
-\
-	return NULL\
 
 #endif /* < KERNEL_VERSION(2, 6, 36) */
 
@@ -344,14 +342,12 @@ static int __batadv_interface_set_mac_addr(x, y)
 
 #ifndef netdev_master_upper_dev_get_rcu
 #define netdev_master_upper_dev_get_rcu(dev) \
-	upper; \
-	rcu_read_unlock(); \
+	NULL; \
 	if (dev->priv_flags & IFF_BRIDGE_PORT) { \
+		rcu_read_unlock(); \
 		dev_hold(dev); \
 		return dev; \
-	} \
-\
-	return NULL\
+	}
 
 #endif /* netdev_master_upper_dev_get_rcu */
 
-- 
1.7.10.4


             reply	other threads:[~2013-11-11 16:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-11 16:33 Simon Wunderlich [this message]
2014-02-16 11:31 ` [B.A.T.M.A.N.] [PATCH] batman-adv: silence smatch errors in multicast compat code Linus Lüssing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384187589-23259-1-git-send-email-sw@simonwunderlich.de \
    --to=sw@simonwunderlich.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).