diff options
author | des <des@FreeBSD.org> | 2008-10-23 20:26:15 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2008-10-23 20:26:15 +0000 |
commit | a1e1ad22e07d384a9609e60cdf00daf7cac902cf (patch) | |
tree | 8c9f9efa0a9f52794e2ce1fe47128f50d30f8c28 /sys/dev | |
parent | 0b81365bc66eb70b9d9b1466012b41f8ccdec19a (diff) | |
download | FreeBSD-src-a1e1ad22e07d384a9609e60cdf00daf7cac902cf.zip FreeBSD-src-a1e1ad22e07d384a9609e60cdf00daf7cac902cf.tar.gz |
Fix a number of style issues in the MALLOC / FREE commit. I've tried to
be careful not to fix anything that was already broken; the NFSv4 code is
particularly bad in this respect.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/hwpmc/hwpmc_mod.c | 22 | ||||
-rw-r--r-- | sys/dev/hwpmc/hwpmc_piv.c | 6 | ||||
-rw-r--r-- | sys/dev/ray/if_ray.c | 2 | ||||
-rw-r--r-- | sys/dev/sr/if_sr.c | 2 |
4 files changed, 15 insertions, 17 deletions
diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index 3bda5ba..f750d46 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -331,8 +331,7 @@ pmc_debugflags_parse(char *newstr, char *fence) int error, found, *newbits, tmp; size_t kwlen; - tmpflags = malloc(sizeof(*tmpflags), - M_PMC, M_WAITOK|M_ZERO); + tmpflags = malloc(sizeof(*tmpflags), M_PMC, M_WAITOK|M_ZERO); p = newstr; error = 0; @@ -777,8 +776,7 @@ pmc_link_target_process(struct pmc *pm, struct pmc_process *pp) __LINE__, pp, pm)); #endif - pt = malloc(sizeof(struct pmc_target), - M_PMC, M_ZERO|M_WAITOK); + pt = malloc(sizeof(struct pmc_target), M_PMC, M_ZERO|M_WAITOK); pt->pt_process = pp; @@ -1861,8 +1859,7 @@ pmc_allocate_owner_descriptor(struct proc *p) poh = &pmc_ownerhash[hindex]; /* allocate space for N pointers and one descriptor struct */ - po = malloc(sizeof(struct pmc_owner), - M_PMC, M_ZERO|M_WAITOK); + po = malloc(sizeof(struct pmc_owner), M_PMC, M_ZERO|M_WAITOK); po->po_sscount = po->po_error = po->po_flags = 0; po->po_file = NULL; @@ -1915,7 +1912,7 @@ pmc_find_process_descriptor(struct proc *p, uint32_t mode) if (mode & PMC_FLAG_ALLOCATE) { /* allocate additional space for 'n' pmc pointers */ - ppnew = malloc( sizeof(struct pmc_process) + md->pmd_npmc * + ppnew = malloc(sizeof(struct pmc_process) + md->pmd_npmc * sizeof(struct pmc_targetstate), M_PMC, M_ZERO|M_WAITOK); } @@ -2818,8 +2815,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args) npmc = md->pmd_npmc; pmcinfo_size = npmc * sizeof(struct pmc_info); - pmcinfo = malloc(pmcinfo_size, M_PMC, - M_WAITOK); + pmcinfo = malloc(pmcinfo_size, M_PMC, M_WAITOK); p = pmcinfo; @@ -4356,7 +4352,8 @@ pmc_initialize(void) M_PMC, M_WAITOK|M_ZERO); /* per-cpu 'saved values' for managing process-mode PMCs */ - pmc_pcpu_saved = malloc( sizeof(pmc_value_t) * maxcpu * md->pmd_npmc, M_PMC, M_WAITOK); + pmc_pcpu_saved = malloc(sizeof(pmc_value_t) * maxcpu * md->pmd_npmc, + M_PMC, M_WAITOK); /* Perform CPU-dependent initialization. */ pmc_save_cpu_binding(&pb); @@ -4376,7 +4373,7 @@ pmc_initialize(void) for (cpu = 0; cpu < maxcpu; cpu++) { if (!pmc_cpu_is_active(cpu)) continue; - sb = malloc( sizeof(struct pmc_samplebuffer) + + sb = malloc(sizeof(struct pmc_samplebuffer) + pmc_nsamples * sizeof(struct pmc_sample), M_PMC, M_WAITOK|M_ZERO); @@ -4385,7 +4382,8 @@ pmc_initialize(void) KASSERT(pmc_pcpu[cpu] != NULL, ("[pmc,%d] cpu=%d Null per-cpu data", __LINE__, cpu)); - sb->ps_callchains = malloc( pmc_callchaindepth * pmc_nsamples * sizeof(uintptr_t), + sb->ps_callchains = malloc(pmc_callchaindepth * + pmc_nsamples * sizeof(uintptr_t), M_PMC, M_WAITOK|M_ZERO); for (n = 0, ps = sb->ps_samples; n < pmc_nsamples; n++, ps++) diff --git a/sys/dev/hwpmc/hwpmc_piv.c b/sys/dev/hwpmc/hwpmc_piv.c index 01de68c..b8f530c 100644 --- a/sys/dev/hwpmc/hwpmc_piv.c +++ b/sys/dev/hwpmc/hwpmc_piv.c @@ -628,7 +628,8 @@ p4_init(int cpu) if (pcs == NULL) /* decline to init */ return ENXIO; - plcs = malloc( sizeof(struct p4_logicalcpu), M_PMC, M_WAITOK|M_ZERO); + plcs = malloc(sizeof(struct p4_logicalcpu), + M_PMC, M_WAITOK|M_ZERO); /* The TSC is architectural state and is not shared */ plcs->pc_hwpmcs[0] = &plcs->pc_tsc; @@ -644,8 +645,7 @@ p4_init(int cpu) return 0; } - pcs = malloc(sizeof(struct p4_cpu), M_PMC, - M_WAITOK|M_ZERO); + pcs = malloc(sizeof(struct p4_cpu), M_PMC, M_WAITOK|M_ZERO); if (pcs == NULL) return ENOMEM; diff --git a/sys/dev/ray/if_ray.c b/sys/dev/ray/if_ray.c index 513312c..9706f0f 100644 --- a/sys/dev/ray/if_ray.c +++ b/sys/dev/ray/if_ray.c @@ -3177,7 +3177,7 @@ ray_com_malloc(ray_comqfn_t function, int flags, char *mesg) { struct ray_comq_entry *com; - com = malloc( sizeof(struct ray_comq_entry), M_RAYCOM, M_WAITOK); + com = malloc(sizeof(struct ray_comq_entry), M_RAYCOM, M_WAITOK); return (ray_com_init(com, function, flags, mesg)); } diff --git a/sys/dev/sr/if_sr.c b/sys/dev/sr/if_sr.c index 5507715..79db670 100644 --- a/sys/dev/sr/if_sr.c +++ b/sys/dev/sr/if_sr.c @@ -305,7 +305,7 @@ sr_attach(device_t device) int unit; /* index: channel w/in card */ hc = (struct sr_hardc *)device_get_softc(device); - sc = malloc( hc->numports * sizeof(struct sr_softc), + sc = malloc(hc->numports * sizeof(struct sr_softc), M_DEVBUF, M_WAITOK | M_ZERO); if (sc == NULL) goto errexit; |