Module Name:    src
Committed By:   ozaki-r
Date:           Fri Apr 24 08:53:06 UTC 2015

Modified Files:
        src/sys/netinet6: ip6_output.c

Log Message:
Avoid NULL checks for a variable that is definitely NULL


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/netinet6/ip6_output.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/ip6_output.c
diff -u src/sys/netinet6/ip6_output.c:1.163 src/sys/netinet6/ip6_output.c:1.164
--- src/sys/netinet6/ip6_output.c:1.163	Mon Feb  2 03:14:02 2015
+++ src/sys/netinet6/ip6_output.c	Fri Apr 24 08:53:06 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_output.c,v 1.163 2015/02/02 03:14:02 christos Exp $	*/
+/*	$NetBSD: ip6_output.c,v 1.164 2015/04/24 08:53:06 ozaki-r Exp $	*/
 /*	$KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.163 2015/02/02 03:14:02 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_output.c,v 1.164 2015/04/24 08:53:06 ozaki-r Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -167,7 +167,7 @@ ip6_output(
 	bool tso;
 	struct route ip6route;
 	struct rtentry *rt = NULL;
-	const struct sockaddr_in6 *dst = NULL;
+	const struct sockaddr_in6 *dst;
 	struct sockaddr_in6 src_sa, dst_sa;
 	int error = 0;
 	struct in6_ifaddr *ia = NULL;
@@ -543,8 +543,7 @@ ip6_output(
 	/* scope check is done. */
 
 	if (rt == NULL || IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
-		if (dst == NULL)
-			dst = satocsin6(rtcache_getdst(ro));
+		dst = satocsin6(rtcache_getdst(ro));
 		KASSERT(dst != NULL);
 	} else if (opt && rtcache_validate(&opt->ip6po_nextroute) != NULL) {
 		/*
@@ -555,7 +554,7 @@ ip6_output(
 		dst = (struct sockaddr_in6 *)opt->ip6po_nexthop;
 	} else if ((rt->rt_flags & RTF_GATEWAY))
 		dst = (struct sockaddr_in6 *)rt->rt_gateway;
-	else if (dst == NULL)
+	else
 		dst = satocsin6(rtcache_getdst(ro));
 
 	/*

Reply via email to