malloc(9) cannot return NULL if M_WAITOK flag is specified.
This commit is contained in:
parent
00848b4635
commit
6fde656c55
@ -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);
|
||||
|
@ -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));
|
||||
|
Loading…
x
Reference in New Issue
Block a user