diff mbox

netfilter: nfnetlink: silence warning if CONFIG_PROVE_RCU isn't set

Message ID 1362401141.16460.24.camel@x61.thuisdomein
State Accepted
Headers show

Commit Message

Paul Bolle March 4, 2013, 12:45 p.m. UTC
Since commit c14b78e7decd0d1d5add6a4604feb8609fe920a9 ("netfilter:
nfnetlink: add mutex per subsystem") building nefnetlink.o without
CONFIG_PROVE_RCU set, triggers this GCC warning:
    net/netfilter/nfnetlink.c:65:22: warning: ‘nfnl_get_lock’ defined but not used [-Wunused-function]

The cause of that warning is, in short, that rcu_lockdep_assert()
compiles away if CONFIG_PROVE_RCU is not set. Silence this warning by
open coding nfnl_get_lock() in the sole place it was called, which
allows to remove that function.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
---
0) Compile tested only, but without CONFIG_PROVE_RCU set! This patch
needs building and running by someone who actually uses that option.

1) This patch triggers a checkpatch "line over 80 characters" warning.
But note that it actually shortens the line checkpatch complains about
(by one character!).

 net/netfilter/nfnetlink.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Pablo Neira Ayuso March 4, 2013, 3:59 p.m. UTC | #1
On Mon, Mar 04, 2013 at 01:45:41PM +0100, Paul Bolle wrote:
> Since commit c14b78e7decd0d1d5add6a4604feb8609fe920a9 ("netfilter:
> nfnetlink: add mutex per subsystem") building nefnetlink.o without
> CONFIG_PROVE_RCU set, triggers this GCC warning:
>     net/netfilter/nfnetlink.c:65:22: warning: ‘nfnl_get_lock’ defined but not used [-Wunused-function]
> 
> The cause of that warning is, in short, that rcu_lockdep_assert()
> compiles away if CONFIG_PROVE_RCU is not set. Silence this warning by
> open coding nfnl_get_lock() in the sole place it was called, which
> allows to remove that function.

Applied, thanks Paul.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index d578ec2..0b1b32c 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -62,11 +62,6 @@  void nfnl_unlock(__u8 subsys_id)
 }
 EXPORT_SYMBOL_GPL(nfnl_unlock);
 
-static struct mutex *nfnl_get_lock(__u8 subsys_id)
-{
-	return &table[subsys_id].mutex;
-}
-
 int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n)
 {
 	nfnl_lock(n->subsys_id);
@@ -199,7 +194,7 @@  replay:
 			rcu_read_unlock();
 			nfnl_lock(subsys_id);
 			if (rcu_dereference_protected(table[subsys_id].subsys,
-				lockdep_is_held(nfnl_get_lock(subsys_id))) != ss ||
+				lockdep_is_held(&table[subsys_id].mutex)) != ss ||
 			    nfnetlink_find_client(type, ss) != nc)
 				err = -EAGAIN;
 			else if (nc->call)