malloc(9) cannot return NULL if M_WAITOK flag is specified.

This commit is contained in:
davide 2013-04-30 15:59:22 +00:00
parent 00848b4635
commit 6fde656c55
2 changed files with 5 additions and 17 deletions

View File

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

View File

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