linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: core: remove unnecessary code
@ 2017-05-03 17:17 Gustavo A. R. Silva
  0 siblings, 0 replies; only message in thread
From: Gustavo A. R. Silva @ 2017-05-03 17:17 UTC (permalink / raw)
  To: David S. Miller, Jesper Dangaard Brouer, Eric Dumazet
  Cc: netdev, linux-kernel, Gustavo A. R. Silva

The name of an array used by itself will always return the array's address.
So this test will always evaluate as true.

Addresses-Coverity-ID: 115325
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 net/core/netpoll.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 9424673..27ce3b1 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -657,13 +657,13 @@ int netpoll_setup(struct netpoll *np)
 {
 	struct net_device *ndev = NULL;
 	struct in_device *in_dev;
+	struct net *net;
 	int err;
 
 	rtnl_lock();
-	if (np->dev_name) {
-		struct net *net = current->nsproxy->net_ns;
-		ndev = __dev_get_by_name(net, np->dev_name);
-	}
+	net = current->nsproxy->net_ns;
+	ndev = __dev_get_by_name(net, np->dev_name);
+
 	if (!ndev) {
 		np_err(np, "%s doesn't exist, aborting\n", np->dev_name);
 		err = -ENODEV;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-05-03 17:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 17:17 [PATCH] net: core: remove unnecessary code Gustavo A. R. Silva

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).