Author: mjg
Date: Mon Nov  3 05:12:17 2014
New Revision: 274007
URL: https://svnweb.freebsd.org/changeset/base/274007

Log:
  filedesc: plug unnecessary fdp NULL checks in fdescfreee and fdcopy
  
  Anything reaching these functions has fd table.

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c        Mon Nov  3 04:41:29 2014        
(r274006)
+++ head/sys/kern/kern_descrip.c        Mon Nov  3 05:12:17 2014        
(r274007)
@@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/unistd.h>
 #include <sys/user.h>
 #include <sys/vnode.h>
+#include <sys/kdb.h>
 #ifdef KTRACE
 #include <sys/ktrace.h>
 #endif
@@ -1910,9 +1911,7 @@ fdcopy(struct filedesc *fdp)
        struct filedescent *nfde, *ofde;
        int i;
 
-       /* Certain daemons might not have file descriptors. */
-       if (fdp == NULL)
-               return (NULL);
+       MPASS(fdp != NULL);
 
        newfdp = fdinit(fdp);
        /* copy all passable descriptors (i.e. not kqueue) */
@@ -2034,10 +2033,8 @@ fdescfree(struct thread *td)
        struct vnode *cdir, *jdir, *rdir;
        int i;
 
-       /* Certain daemons might not have file descriptors. */
        fdp = td->td_proc->p_fd;
-       if (fdp == NULL)
-               return;
+       MPASS(fdp != NULL);
 
 #ifdef RACCT
        PROC_LOCK(td->td_proc);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to