Coverity CID 1050, 1051: Correct NULL guards.
This commit is contained in:
parent
55f3f4d6c8
commit
1ec3fc44a3
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_clock.c,v 1.96 2005/12/11 12:24:29 christos Exp $ */
|
||||
/* $NetBSD: kern_clock.c,v 1.97 2006/04/15 00:34:42 elad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000, 2004 The NetBSD Foundation, Inc.
|
||||
@ -76,7 +76,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.96 2005/12/11 12:24:29 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.97 2006/04/15 00:34:42 elad Exp $");
|
||||
|
||||
#include "opt_ntp.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
@ -991,7 +991,7 @@ proftick(struct clockframe *frame)
|
||||
}
|
||||
#endif
|
||||
#ifdef PROC_PC
|
||||
if (p && p->p_flag & P_PROFIL)
|
||||
if (p && (p->p_flag & P_PROFIL))
|
||||
addupc_intr(p, PROC_PC(p));
|
||||
#endif
|
||||
}
|
||||
@ -1011,7 +1011,6 @@ statclock(struct clockframe *frame)
|
||||
#endif
|
||||
struct cpu_info *ci = curcpu();
|
||||
struct schedstate_percpu *spc = &ci->ci_schedstate;
|
||||
struct lwp *l;
|
||||
struct proc *p;
|
||||
|
||||
/*
|
||||
@ -1027,10 +1026,11 @@ statclock(struct clockframe *frame)
|
||||
setstatclockrate(profhz);
|
||||
}
|
||||
}
|
||||
l = curlwp;
|
||||
p = (l ? l->l_proc : 0);
|
||||
p = (curlwp ? curlwp->l_proc : NULL);
|
||||
if (CLKF_USERMODE(frame)) {
|
||||
if (p->p_flag & P_PROFIL && profsrc == PROFSRC_CLOCK)
|
||||
KASSERT(p != NULL);
|
||||
|
||||
if ((p->p_flag & P_PROFIL) && profsrc == PROFSRC_CLOCK)
|
||||
addupc_intr(p, CLKF_PC(frame));
|
||||
if (--spc->spc_pscnt > 0)
|
||||
return;
|
||||
@ -1058,7 +1058,7 @@ statclock(struct clockframe *frame)
|
||||
}
|
||||
#endif
|
||||
#ifdef LWP_PC
|
||||
if (p && profsrc == PROFSRC_CLOCK && p->p_flag & P_PROFIL)
|
||||
if (p && profsrc == PROFSRC_CLOCK && (p->p_flag & P_PROFIL))
|
||||
addupc_intr(p, LWP_PC(l));
|
||||
#endif
|
||||
if (--spc->spc_pscnt > 0)
|
||||
@ -1087,7 +1087,7 @@ statclock(struct clockframe *frame)
|
||||
}
|
||||
spc->spc_pscnt = psdiv;
|
||||
|
||||
if (l != NULL) {
|
||||
if (p != NULL) {
|
||||
++p->p_cpticks;
|
||||
/*
|
||||
* If no separate schedclock is provided, call it here
|
||||
|
Loading…
x
Reference in New Issue
Block a user