summaryrefslogtreecommitdiffstats
path: root/net/mpls
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-08-04 10:44:22 +0300
committerDavid S. Miller <davem@davemloft.net>2015-08-06 21:56:55 -0700
commit5a9348b54d396c0b8bb877abcb107293034a87de (patch)
tree4e5da9caa8ad15e4765690ebce4be1bf1b8c0726 /net/mpls
parent02b52428475672a241365910949deb6fe95d043c (diff)
downloadlinux-5a9348b54d396c0b8bb877abcb107293034a87de.tar.gz
linux-5a9348b54d396c0b8bb877abcb107293034a87de.tar.xz
mpls: small cleanup in inet/inet6_fib_lookup_dev()
We recently changed this code from returning NULL to returning ERR_PTR. There are some left over NULL assignments which we can remove. We can preserve the error code from ip_route_output() instead of always returning -ENODEV. Also these functions use a mix of gotos and direct returns. There is no cleanup necessary so I changed the gotos to direct returns. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com> Acked-by: Robert Shearman <rshearma@brocade.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mpls')
-rw-r--r--net/mpls/af_mpls.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index b6b9a6c4e784..d93c0301ad23 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -338,14 +338,14 @@ static unsigned find_free_label(struct net *net)
#if IS_ENABLED(CONFIG_INET)
static struct net_device *inet_fib_lookup_dev(struct net *net, void *addr)
{
- struct net_device *dev = NULL;
+ struct net_device *dev;
struct rtable *rt;
struct in_addr daddr;
memcpy(&daddr, addr, sizeof(struct in_addr));
rt = ip_route_output(net, daddr.s_addr, 0, 0, 0);
if (IS_ERR(rt))
- goto errout;
+ return ERR_CAST(rt);
dev = rt->dst.dev;
dev_hold(dev);
@@ -353,8 +353,6 @@ static struct net_device *inet_fib_lookup_dev(struct net *net, void *addr)
ip_rt_put(rt);
return dev;
-errout:
- return ERR_PTR(-ENODEV);
}
#else
static struct net_device *inet_fib_lookup_dev(struct net *net, void *addr)
@@ -366,7 +364,7 @@ static struct net_device *inet_fib_lookup_dev(struct net *net, void *addr)
#if IS_ENABLED(CONFIG_IPV6)
static struct net_device *inet6_fib_lookup_dev(struct net *net, void *addr)
{
- struct net_device *dev = NULL;
+ struct net_device *dev;
struct dst_entry *dst;
struct flowi6 fl6;
int err;
@@ -378,16 +376,13 @@ static struct net_device *inet6_fib_lookup_dev(struct net *net, void *addr)
memcpy(&fl6.daddr, addr, sizeof(struct in6_addr));
err = ipv6_stub->ipv6_dst_lookup(net, NULL, &dst, &fl6);
if (err)
- goto errout;
+ return ERR_PTR(err);
dev = dst->dev;
dev_hold(dev);
dst_release(dst);
return dev;
-
-errout:
- return ERR_PTR(err);
}
#else
static struct net_device *inet6_fib_lookup_dev(struct net *net, void *addr)