summaryrefslogtreecommitdiffstats
path: root/sys/dev/hwpmc
diff options
context:
space:
mode:
authordavide <davide@FreeBSD.org>2013-04-30 15:59:22 +0000
committerdavide <davide@FreeBSD.org>2013-04-30 15:59:22 +0000
commit6fde656c558ac5ebbb46636bfd840a1279f550fb (patch)
tree0bfef1aed034eae60ad4ac5314fef8c36fb6d390 /sys/dev/hwpmc
parent00848b46351df0b5138cb0b9cda3e1a4753e332f (diff)
downloadFreeBSD-src-6fde656c558ac5ebbb46636bfd840a1279f550fb.zip
FreeBSD-src-6fde656c558ac5ebbb46636bfd840a1279f550fb.tar.gz
malloc(9) cannot return NULL if M_WAITOK flag is specified.
Diffstat (limited to 'sys/dev/hwpmc')
-rw-r--r--sys/dev/hwpmc/hwpmc_mod.c19
-rw-r--r--sys/dev/hwpmc/hwpmc_soft.c3
2 files changed, 5 insertions, 17 deletions
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c
index 0c250bc..eec33a3 100644
--- a/sys/dev/hwpmc/hwpmc_mod.c
+++ b/sys/dev/hwpmc/hwpmc_mod.c
@@ -2210,11 +2210,8 @@ pmc_allocate_pmc_descriptor(void)
struct pmc *pmc;
pmc = malloc(sizeof(struct pmc), M_PMC, M_WAITOK|M_ZERO);
-
- if (pmc != NULL) {
- pmc->pm_owner = NULL;
- LIST_INIT(&pmc->pm_targets);
- }
+ pmc->pm_owner = NULL;
+ LIST_INIT(&pmc->pm_targets);
PMCDBG(PMC,ALL,1, "allocate-pmc -> pmc=%p", pmc);
@@ -4671,13 +4668,10 @@ pmc_mdep_alloc(int nclasses)
n = 1 + nclasses;
md = malloc(sizeof(struct pmc_mdep) + n *
sizeof(struct pmc_classdep), M_PMC, M_WAITOK|M_ZERO);
- if (md != NULL) {
- md->pmd_nclass = n;
-
- /* Add base class. */
- pmc_soft_initialize(md);
- }
+ md->pmd_nclass = n;
+ /* Add base class. */
+ pmc_soft_initialize(md);
return md;
}
@@ -4889,9 +4883,6 @@ pmc_initialize(void)
pmc_pmcdisp = malloc(sizeof(enum pmc_mode) * md->pmd_npmc,
M_PMC, M_WAITOK|M_ZERO);
- KASSERT(pmc_pmcdisp != NULL,
- ("[pmc,%d] pmcdisp allocation returned NULL", __LINE__));
-
/* mark all PMCs as available */
for (n = 0; n < (int) md->pmd_npmc; n++)
PMC_MARK_ROW_FREE(n);
diff --git a/sys/dev/hwpmc/hwpmc_soft.c b/sys/dev/hwpmc/hwpmc_soft.c
index 56af775..7a585eb 100644
--- a/sys/dev/hwpmc/hwpmc_soft.c
+++ b/sys/dev/hwpmc/hwpmc_soft.c
@@ -241,9 +241,6 @@ soft_pcpu_init(struct pmc_mdep *md, int cpu)
__LINE__));
soft_pc = malloc(sizeof(struct soft_cpu), M_PMC, M_WAITOK|M_ZERO);
- if (soft_pc == NULL)
- return (ENOMEM);
-
pc = pmc_pcpu[cpu];
KASSERT(pc != NULL, ("[soft,%d] cpu %d null per-cpu", __LINE__, cpu));
OpenPOWER on IntegriCloud