filedesc: plug unnecessary fdp NULL checks in fdescfreee and fdcopy

Anything reaching these functions has fd table.
This commit is contained in:
Mateusz Guzik 2014-11-03 05:12:17 +00:00
parent 1077321975
commit 1d29258ac2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=274007

View File

@ -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);