Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Mar 2012 09:22:05 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r232818 - stable/8/sys/kern
Message-ID:  <201203110922.q2B9M57e002991@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Sun Mar 11 09:22:05 2012
New Revision: 232818
URL: http://svn.freebsd.org/changeset/base/232818

Log:
  MFC r232178:
  Remove apparently redundand checks for socket so_proto being non-NULL
  from sosetopt() and sogetopt().

Modified:
  stable/8/sys/kern/uipc_socket.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/kern/uipc_socket.c
==============================================================================
--- stable/8/sys/kern/uipc_socket.c	Sun Mar 11 08:12:30 2012	(r232817)
+++ stable/8/sys/kern/uipc_socket.c	Sun Mar 11 09:22:05 2012	(r232818)
@@ -2436,7 +2436,7 @@ sosetopt(struct socket *so, struct socko
 	CURVNET_SET(so->so_vnet);
 	error = 0;
 	if (sopt->sopt_level != SOL_SOCKET) {
-		if (so->so_proto && so->so_proto->pr_ctloutput) {
+		if (so->so_proto->pr_ctloutput != NULL) {
 			error = (*so->so_proto->pr_ctloutput)(so, sopt);
 			CURVNET_RESTORE();
 			return (error);
@@ -2497,8 +2497,7 @@ sosetopt(struct socket *so, struct socko
 				error = EINVAL;
 				goto bad;
 			}
-			if (so->so_proto != NULL &&
-			   ((so->so_proto->pr_domain->dom_family == PF_INET) ||
+			if (((so->so_proto->pr_domain->dom_family == PF_INET) ||
 			   (so->so_proto->pr_domain->dom_family == PF_INET6) ||
 			   (so->so_proto->pr_domain->dom_family == PF_ROUTE))) {
 				so->so_fibnum = optval;
@@ -2621,11 +2620,8 @@ sosetopt(struct socket *so, struct socko
 			error = ENOPROTOOPT;
 			break;
 		}
-		if (error == 0 && so->so_proto != NULL &&
-		    so->so_proto->pr_ctloutput != NULL) {
-			(void) ((*so->so_proto->pr_ctloutput)
-				  (so, sopt));
-		}
+		if (error == 0 && so->so_proto->pr_ctloutput != NULL)
+			(void)(*so->so_proto->pr_ctloutput)(so, sopt);
 	}
 bad:
 	CURVNET_RESTORE();
@@ -2675,7 +2671,7 @@ sogetopt(struct socket *so, struct socko
 	CURVNET_SET(so->so_vnet);
 	error = 0;
 	if (sopt->sopt_level != SOL_SOCKET) {
-		if (so->so_proto && so->so_proto->pr_ctloutput)
+		if (so->so_proto->pr_ctloutput != NULL)
 			error = (*so->so_proto->pr_ctloutput)(so, sopt);
 		else
 			error = ENOPROTOOPT;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203110922.q2B9M57e002991>