svn commit: r216104 - head/sys/kern

Edward Tomasz Napierala trasz at FreeBSD.org
Thu Dec 2 01:14:46 UTC 2010


Author: trasz
Date: Thu Dec  2 01:14:45 2010
New Revision: 216104
URL: http://svn.freebsd.org/changeset/base/216104

Log:
  Remove useless NULL checks for M_WAITOK mallocs.

Modified:
  head/sys/kern/sysv_msg.c
  head/sys/kern/sysv_shm.c

Modified: head/sys/kern/sysv_msg.c
==============================================================================
--- head/sys/kern/sysv_msg.c	Thu Dec  2 01:01:37 2010	(r216103)
+++ head/sys/kern/sysv_msg.c	Thu Dec  2 01:14:45 2010	(r216104)
@@ -200,18 +200,10 @@ msginit()
 	TUNABLE_INT_FETCH("kern.ipc.msgtql", &msginfo.msgtql);
 
 	msgpool = malloc(msginfo.msgmax, M_MSG, M_WAITOK);
-	if (msgpool == NULL)
-		panic("msgpool is NULL");
 	msgmaps = malloc(sizeof(struct msgmap) * msginfo.msgseg, M_MSG, M_WAITOK);
-	if (msgmaps == NULL)
-		panic("msgmaps is NULL");
 	msghdrs = malloc(sizeof(struct msg) * msginfo.msgtql, M_MSG, M_WAITOK);
-	if (msghdrs == NULL)
-		panic("msghdrs is NULL");
 	msqids = malloc(sizeof(struct msqid_kernel) * msginfo.msgmni, M_MSG,
 	    M_WAITOK);
-	if (msqids == NULL)
-		panic("msqids is NULL");
 
 	/*
 	 * msginfo.msgssz should be a power of two for efficiency reasons.
@@ -233,9 +225,6 @@ msginit()
 		panic("msginfo.msgseg > 32767");
 	}
 
-	if (msgmaps == NULL)
-		panic("msgmaps is NULL");
-
 	for (i = 0; i < msginfo.msgseg; i++) {
 		if (i > 0)
 			msgmaps[i-1].next = i;
@@ -244,9 +233,6 @@ msginit()
 	free_msgmaps = 0;
 	nfree_msgmaps = msginfo.msgseg;
 
-	if (msghdrs == NULL)
-		panic("msghdrs is NULL");
-
 	for (i = 0; i < msginfo.msgtql; i++) {
 		msghdrs[i].msg_type = 0;
 		if (i > 0)
@@ -258,9 +244,6 @@ msginit()
     	}
 	free_msghdrs = &msghdrs[0];
 
-	if (msqids == NULL)
-		panic("msqids is NULL");
-
 	for (i = 0; i < msginfo.msgmni; i++) {
 		msqids[i].u.msg_qbytes = 0;	/* implies entry is available */
 		msqids[i].u.msg_perm.seq = 0;	/* reset to a known value */

Modified: head/sys/kern/sysv_shm.c
==============================================================================
--- head/sys/kern/sysv_shm.c	Thu Dec  2 01:01:37 2010	(r216103)
+++ head/sys/kern/sysv_shm.c	Thu Dec  2 01:14:45 2010	(r216104)
@@ -878,8 +878,6 @@ shminit()
 
 	shmalloced = shminfo.shmmni;
 	shmsegs = malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, M_WAITOK);
-	if (shmsegs == NULL)
-		panic("cannot allocate initial memory for sysvshm");
 	for (i = 0; i < shmalloced; i++) {
 		shmsegs[i].u.shm_perm.mode = SHMSEG_FREE;
 		shmsegs[i].u.shm_perm.seq = 0;


More information about the svn-src-all mailing list