summaryrefslogtreecommitdiffstats
path: root/sys/dev/hwpmc
diff options
context:
space:
mode:
authorfabient <fabient@FreeBSD.org>2010-06-05 23:05:08 +0000
committerfabient <fabient@FreeBSD.org>2010-06-05 23:05:08 +0000
commitd568e764e9e97abcee15781a50ecc37d6773b322 (patch)
tree0fec01ed90652775e9a69936b23d03ff991367b6 /sys/dev/hwpmc
parentf0b6964bba720b81012adeaabfdffd9da631cd8a (diff)
downloadFreeBSD-src-d568e764e9e97abcee15781a50ecc37d6773b322.zip
FreeBSD-src-d568e764e9e97abcee15781a50ecc37d6773b322.tar.gz
Convert pm_runcount to int to correctly check for negative value.
Remove uncessary check for error. Found with: Coverity Prevent(tm) MFC after: 1 month
Diffstat (limited to 'sys/dev/hwpmc')
-rw-r--r--sys/dev/hwpmc/hwpmc_mod.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
index a19c85e..4fa169c 100644
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -1248,7 +1248,7 @@ pmc_process_csw_in(struct thread *td)
continue;
/* increment PMC runcount */
- atomic_add_rel_32(&pm->pm_runcount, 1);
+ atomic_add_rel_int(&pm->pm_runcount, 1);
/* configure the HWPMC we are going to use. */
pcd = pmc_ri_to_classdep(md, ri, &adjri);
@@ -1387,7 +1387,7 @@ pmc_process_csw_out(struct thread *td)
pcd->pcd_stop_pmc(cpu, adjri);
/* reduce this PMC's runcount */
- atomic_subtract_rel_32(&pm->pm_runcount, 1);
+ atomic_subtract_rel_int(&pm->pm_runcount, 1);
/*
* If this PMC is associated with this process,
@@ -3252,9 +3252,6 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
}
}
- if (error)
- break;
-
/*
* Look for valid values for 'pm_flags'
*/
@@ -4045,7 +4042,7 @@ pmc_process_interrupt(int cpu, struct pmc *pm, struct trapframe *tf,
("[pmc,%d] pm=%p runcount %d", __LINE__, (void *) pm,
pm->pm_runcount));
- atomic_add_rel_32(&pm->pm_runcount, 1); /* hold onto PMC */
+ atomic_add_rel_int(&pm->pm_runcount, 1); /* hold onto PMC */
ps->ps_pmc = pm;
if ((td = curthread) && td->td_proc)
ps->ps_pid = td->td_proc->p_pid;
@@ -4246,7 +4243,7 @@ pmc_process_samples(int cpu)
entrydone:
ps->ps_nsamples = 0; /* mark entry as free */
- atomic_subtract_rel_32(&pm->pm_runcount, 1);
+ atomic_subtract_rel_int(&pm->pm_runcount, 1);
/* increment read pointer, modulo sample size */
if (++ps == psb->ps_fence)
@@ -4418,7 +4415,7 @@ pmc_process_exit(void *arg __unused, struct proc *p)
mtx_pool_unlock_spin(pmc_mtxpool, pm);
}
- atomic_subtract_rel_32(&pm->pm_runcount,1);
+ atomic_subtract_rel_int(&pm->pm_runcount,1);
KASSERT((int) pm->pm_runcount >= 0,
("[pmc,%d] runcount is %d", __LINE__, ri));
OpenPOWER on IntegriCloud