svn commit: r232818 - stable/8/sys/kern

Konstantin Belousov kib at FreeBSD.org
Sun Mar 11 09:22:06 UTC 2012


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;


More information about the svn-src-stable-8 mailing list