diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2005-11-07 06:31:45 -0500 |
---|---|---|
committer | Jody McIntyre <scjody@modernduck.com> | 2005-11-07 06:31:45 -0500 |
commit | 8551158abc8ef45a7f473a87e69624d05ebfd684 (patch) | |
tree | 47cd79c5f5444c7cac812d797764f203207345a7 /drivers/ieee1394/ohci1394.c | |
parent | 7afa1467761f06bd9649efd66a4a6b3ff9f29a1f (diff) |
kmalloc/kzalloc changes:
dv1394, eth1394, ieee1394, ohci1394, pcilynx, raw1394, sbp2c, video1394:
- use kzalloc
- provide safer size arguments to kmalloc and kzalloc
- omit some casts
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Jody McIntyre <scjody@modernduck.com>
Diffstat (limited to 'drivers/ieee1394/ohci1394.c')
-rw-r--r-- | drivers/ieee1394/ohci1394.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c index 8355068b0696..97b6f48033c4 100644 --- a/drivers/ieee1394/ohci1394.c +++ b/drivers/ieee1394/ohci1394.c | |||
@@ -2957,28 +2957,23 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d, | |||
2957 | d->ctrlClear = 0; | 2957 | d->ctrlClear = 0; |
2958 | d->cmdPtr = 0; | 2958 | d->cmdPtr = 0; |
2959 | 2959 | ||
2960 | d->buf_cpu = kmalloc(d->num_desc * sizeof(quadlet_t*), GFP_ATOMIC); | 2960 | d->buf_cpu = kzalloc(d->num_desc * sizeof(*d->buf_cpu), GFP_ATOMIC); |
2961 | d->buf_bus = kmalloc(d->num_desc * sizeof(dma_addr_t), GFP_ATOMIC); | 2961 | d->buf_bus = kzalloc(d->num_desc * sizeof(*d->buf_bus), GFP_ATOMIC); |
2962 | 2962 | ||
2963 | if (d->buf_cpu == NULL || d->buf_bus == NULL) { | 2963 | if (d->buf_cpu == NULL || d->buf_bus == NULL) { |
2964 | PRINT(KERN_ERR, "Failed to allocate dma buffer"); | 2964 | PRINT(KERN_ERR, "Failed to allocate dma buffer"); |
2965 | free_dma_rcv_ctx(d); | 2965 | free_dma_rcv_ctx(d); |
2966 | return -ENOMEM; | 2966 | return -ENOMEM; |
2967 | } | 2967 | } |
2968 | memset(d->buf_cpu, 0, d->num_desc * sizeof(quadlet_t*)); | ||
2969 | memset(d->buf_bus, 0, d->num_desc * sizeof(dma_addr_t)); | ||
2970 | 2968 | ||
2971 | d->prg_cpu = kmalloc(d->num_desc * sizeof(struct dma_cmd*), | 2969 | d->prg_cpu = kzalloc(d->num_desc * sizeof(*d->prg_cpu), GFP_ATOMIC); |
2972 | GFP_ATOMIC); | 2970 | d->prg_bus = kzalloc(d->num_desc * sizeof(*d->prg_bus), GFP_ATOMIC); |
2973 | d->prg_bus = kmalloc(d->num_desc * sizeof(dma_addr_t), GFP_ATOMIC); | ||
2974 | 2971 | ||
2975 | if (d->prg_cpu == NULL || d->prg_bus == NULL) { | 2972 | if (d->prg_cpu == NULL || d->prg_bus == NULL) { |
2976 | PRINT(KERN_ERR, "Failed to allocate dma prg"); | 2973 | PRINT(KERN_ERR, "Failed to allocate dma prg"); |
2977 | free_dma_rcv_ctx(d); | 2974 | free_dma_rcv_ctx(d); |
2978 | return -ENOMEM; | 2975 | return -ENOMEM; |
2979 | } | 2976 | } |
2980 | memset(d->prg_cpu, 0, d->num_desc * sizeof(struct dma_cmd*)); | ||
2981 | memset(d->prg_bus, 0, d->num_desc * sizeof(dma_addr_t)); | ||
2982 | 2977 | ||
2983 | d->spb = kmalloc(d->split_buf_size, GFP_ATOMIC); | 2978 | d->spb = kmalloc(d->split_buf_size, GFP_ATOMIC); |
2984 | 2979 | ||
@@ -3090,17 +3085,14 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d, | |||
3090 | d->ctrlClear = 0; | 3085 | d->ctrlClear = 0; |
3091 | d->cmdPtr = 0; | 3086 | d->cmdPtr = 0; |
3092 | 3087 | ||
3093 | d->prg_cpu = kmalloc(d->num_desc * sizeof(struct at_dma_prg*), | 3088 | d->prg_cpu = kzalloc(d->num_desc * sizeof(*d->prg_cpu), GFP_KERNEL); |
3094 | GFP_KERNEL); | 3089 | d->prg_bus = kzalloc(d->num_desc * sizeof(*d->prg_bus), GFP_KERNEL); |
3095 | d->prg_bus = kmalloc(d->num_desc * sizeof(dma_addr_t), GFP_KERNEL); | ||
3096 | 3090 | ||
3097 | if (d->prg_cpu == NULL || d->prg_bus == NULL) { | 3091 | if (d->prg_cpu == NULL || d->prg_bus == NULL) { |
3098 | PRINT(KERN_ERR, "Failed to allocate at dma prg"); | 3092 | PRINT(KERN_ERR, "Failed to allocate at dma prg"); |
3099 | free_dma_trm_ctx(d); | 3093 | free_dma_trm_ctx(d); |
3100 | return -ENOMEM; | 3094 | return -ENOMEM; |
3101 | } | 3095 | } |
3102 | memset(d->prg_cpu, 0, d->num_desc * sizeof(struct at_dma_prg*)); | ||
3103 | memset(d->prg_bus, 0, d->num_desc * sizeof(dma_addr_t)); | ||
3104 | 3096 | ||
3105 | len = sprintf(pool_name, "ohci1394_trm_prg"); | 3097 | len = sprintf(pool_name, "ohci1394_trm_prg"); |
3106 | sprintf(pool_name+len, "%d", num_allocs); | 3098 | sprintf(pool_name+len, "%d", num_allocs); |