svn commit: r232804 - stable/9/sys/kern

Konstantin Belousov kib at FreeBSD.org
Sun Mar 11 00:43:02 UTC 2012


Author: kib
Date: Sun Mar 11 00:43:01 2012
New Revision: 232804
URL: http://svn.freebsd.org/changeset/base/232804

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

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

Modified: stable/9/sys/kern/uipc_socket.c
==============================================================================
--- stable/9/sys/kern/uipc_socket.c	Sun Mar 11 00:34:14 2012	(r232803)
+++ stable/9/sys/kern/uipc_socket.c	Sun Mar 11 00:43:01 2012	(r232804)
@@ -2442,7 +2442,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);
@@ -2503,8 +2503,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;
@@ -2636,11 +2635,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();
@@ -2690,7 +2686,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-9 mailing list