ieee1394: Conversions from kmalloc/memset to kzalloc.
PATCH 1/1 ieee1394: Conversions from kmalloc/memset to kzalloc.
ieee1394: Conversions from kmalloc/memset to kzalloc.
Signed-off-by Panagiotis Issaris <[email protected]>
---
drivers/ieee1394/amdtp.c | 3 +-- drivers/ieee1394/dv1394.c | 4 +--- drivers/ieee1394/highlevel.c | 4 +--- drivers/ieee1394/hosts.c | 3 +-- drivers/ieee1394/nodemgr.c | 8 ++------ drivers/ieee1394/ohci1394.c | 18 ++++++------------ drivers/ieee1394/raw1394.c | 7 ++----- drivers/ieee1394/sbp2.c | 7 ++----- drivers/ieee1394/video1394.c | 25 ++++++++----------------- 9 files changed, 24 insertions(+), 55 deletions(-)
applies-to: 1c856cdeb0682c76f2feb48d90dd8d25b9e63ee1 bbec46ecf70c03938b2f85b91678a6e9ae16b5d0
drivers/ieee1394/amdtp.c +1 -2
@@ -1014,11 +1014,10 @@ static struct stream *stream_alloc(strucstruct stream *s;unsigned long flags; - s =kmalloc (sizeof (struct stream ),SLAB_KERNEL ); + s =kzalloc (sizeof (struct stream ),SLAB_KERNEL );if (s ==NULL )return NULL ; -memset (s,0 ,sizeof (struct stream )); s->host = host; s->input =buffer_alloc (BUFFER_SIZE );
drivers/ieee1394/dv1394.c +1 -3
@@ -2218,14 +2218,12 @@ static int dv1394_init(struct ti_ohci *ounsigned long flags;int i; - video =kmalloc (sizeof (struct video_card ),GFP_KERNEL ); + video =kzalloc (sizeof (struct video_card ),GFP_KERNEL );if (!video) {printk (KERN_ERR "dv1394: cannot allocate video_card\n" ); goto err; } -memset (video,0 ,sizeof (struct video_card )); - video->ohci = ohci;/* lower 2 bits of id indicate which of four "plugs" per host */
drivers/ieee1394/highlevel.c +1 -3
@@ -101,12 +101,10 @@ void *hpsb_create_hostinfo(struct hpsb_hreturn NULL ; } - hi =kmalloc (sizeof (*hi) + data_size,GFP_ATOMIC ); + hi =kzalloc (sizeof (*hi) + data_size,GFP_ATOMIC );if (!hi)return NULL ; -memset (hi,0 ,sizeof (*hi) + data_size); -if (data_size) { data = hi->data = hi +1 ; hi->size = data_size;
drivers/ieee1394/hosts.c +1 -2
@@ -114,9 +114,8 @@ struct hpsb_host *hpsb_alloc_host(structint i;int hostnum =0 ; - h =kmalloc (sizeof (struct hpsb_host ) + extra,SLAB_KERNEL ); + h =kzalloc (sizeof (struct hpsb_host ) + extra,SLAB_KERNEL );if (!h)return NULL ; -memset (h,0 ,sizeof (struct hpsb_host ) + extra); h->csr.rom =csr1212_create_csr (&csr_bus_ops,CSR_BUS_INFO_SIZE , h);if (!h->csr.rom) {
drivers/ieee1394/nodemgr.c +2 -6
@@ -745,11 +745,9 @@ static struct node_entry *nodemgr_createstruct hpsb_host *host = hi->host;struct node_entry *ne; - ne =kmalloc (sizeof (struct node_entry ),GFP_KERNEL ); + ne =kzalloc (sizeof (struct node_entry ),GFP_KERNEL );if (!ne)return NULL ; -memset (ne,0 ,sizeof (struct node_entry )); - ne->tpool = &host->tpool[nodeid &NODE_MASK ]; ne->host = host;
@@ -872,12 +870,10 @@ static struct unit_directory *nodemgr_prstruct csr1212_keyval *kv;u8 last_key_id =0 ; - ud =kmalloc (sizeof (struct unit_directory ),GFP_KERNEL ); + ud =kzalloc (sizeof (struct unit_directory ),GFP_KERNEL );if (!ud) goto unit_directory_error; -memset (ud,0 ,sizeof (struct unit_directory )); - ud->ne = ne; ud->ignore_driver = ignore_drivers; ud->address = ud_kv->offset +CSR1212_CONFIG_ROM_SPACE_BASE ;
drivers/ieee1394/ohci1394.c +6 -12
@@ -2960,28 +2960,24 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, d->ctrlClear =0 ; d->cmdPtr =0 ; - d->buf_cpu =kmalloc (d->num_desc *sizeof (quadlet_t *),GFP_ATOMIC ); - d->buf_bus =kmalloc (d->num_desc *sizeof (dma_addr_t),GFP_ATOMIC ); + d->buf_cpu =kzalloc (d->num_desc *sizeof (quadlet_t *),GFP_ATOMIC ); + d->buf_bus =kzalloc (d->num_desc *sizeof (dma_addr_t),GFP_ATOMIC );if (d->buf_cpu ==NULL || d->buf_bus ==NULL ) {KERN_ERR ,"Failed to allocate dma buffer" );free_dma_rcv_ctx (d);return -ENOMEM ; } -memset (d->buf_cpu,0 , d->num_desc *sizeof (quadlet_t *)); -memset (d->buf_bus,0 , d->num_desc *sizeof (dma_addr_t)); - d->prg_cpu =kmalloc (d->num_desc *sizeof (struct dma_cmd *), + d->prg_cpu =kzalloc (d->num_desc *sizeof (struct dma_cmd *),GFP_ATOMIC ); - d->prg_bus =kmalloc (d->num_desc *sizeof (dma_addr_t),GFP_ATOMIC ); + d->prg_bus =kzalloc (d->num_desc *sizeof (dma_addr_t),GFP_ATOMIC );if (d->prg_cpu ==NULL || d->prg_bus ==NULL ) {KERN_ERR ,"Failed to allocate dma prg" );free_dma_rcv_ctx (d);return -ENOMEM ; } -memset (d->prg_cpu,0 , d->num_desc *sizeof (struct dma_cmd *)); -memset (d->prg_bus,0 , d->num_desc *sizeof (dma_addr_t)); d->spb =kmalloc (d->split_buf_size,GFP_ATOMIC );
@@ -3093,17 +3089,15 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, d->ctrlClear =0 ; d->cmdPtr =0 ; - d->prg_cpu =kmalloc (d->num_desc *sizeof (struct at_dma_prg *), + d->prg_cpu =kzalloc (d->num_desc *sizeof (struct at_dma_prg *),GFP_KERNEL ); - d->prg_bus =kmalloc (d->num_desc *sizeof (dma_addr_t),GFP_KERNEL ); + d->prg_bus =kzalloc (d->num_desc *sizeof (dma_addr_t),GFP_KERNEL );if (d->prg_cpu ==NULL || d->prg_bus ==NULL ) {KERN_ERR ,"Failed to allocate at dma prg" );free_dma_trm_ctx (d);return -ENOMEM ; } -memset (d->prg_cpu,0 , d->num_desc *sizeof (struct at_dma_prg *)); -memset (d->prg_bus,0 , d->num_desc *sizeof (dma_addr_t)); len =sprintf (pool_name,"ohci1394_trm_prg" );sprintf (pool_name+len,"%d" , num_allocs);
drivers/ieee1394/raw1394.c +2 -5
@@ -102,10 +102,8 @@ static struct pending_request *__alloc_p {struct pending_request *req; - req = (struct pending_request *)kmalloc (sizeof (struct pending_request ), - flags); + req =kzalloc (sizeof (struct pending_request ), flags);if (req !=NULL ) { -memset (req,0 ,sizeof (struct pending_request ));INIT_LIST_HEAD (&req->list); }
@@ -2684,11 +2682,10 @@ static int raw1394_open(struct inode *in {struct file_info *fi; - fi =kmalloc (sizeof (struct file_info ),SLAB_KERNEL ); + fi =kzalloc (sizeof (struct file_info ),SLAB_KERNEL );if (fi ==NULL )return -ENOMEM ; -memset (fi,0 ,sizeof (struct file_info )); fi->notification = (u8 )RAW1394_NOTIFY_ON ;/* busreset notification */ INIT_LIST_HEAD (&fi->list);
drivers/ieee1394/sbp2.c +2 -5
@@ -417,13 +417,11 @@ static int sbp2util_create_command_orb_pspin_lock_irqsave (&scsi_id->sbp2_command_orb_lock, flags);for (i =0 ; i < orbs; i++) { - command = (struct sbp2_command_info *) -kmalloc (sizeof (struct sbp2_command_info ),GFP_ATOMIC ); + command =kzalloc (sizeof (struct sbp2_command_info ),GFP_ATOMIC );if (!command) {spin_unlock_irqrestore (&scsi_id->sbp2_command_orb_lock, flags);return (-ENOMEM ); } -memset (command,'\0' ,sizeof (struct sbp2_command_info )); command->command_orb_dma = pci_map_single (hi->host->pdev, &command->command_orb, sizeof(struct sbp2_command_orb),
@@ -719,12 +717,11 @@ static struct scsi_id_instance_data *sbpSBP2_DEBUG ("sbp2_alloc_device" ); - scsi_id =kmalloc (sizeof (*scsi_id),GFP_KERNEL ); + scsi_id =kzalloc (sizeof (*scsi_id),GFP_KERNEL );if (!scsi_id) {SBP2_ERR ("failed to create scsi_id" ); goto failed_alloc; } -memset (scsi_id,0 ,sizeof (*scsi_id)); scsi_id->ne = ud->ne; scsi_id->ud = ud;
drivers/ieee1394/video1394.c +8 -17
@@ -206,14 +206,12 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci,struct dma_iso_ctx *d;int i; - d =kmalloc (sizeof (struct dma_iso_ctx ),GFP_KERNEL ); + d =kzalloc (sizeof (struct dma_iso_ctx ),GFP_KERNEL );if (d ==NULL ) {KERN_ERR , ohci->host->id,"Failed to allocate dma_iso_ctx" );return NULL ; } -memset (d,0 ,sizeof *d); - d->ohci = ohci; d->type = type; d->channel = channel;
@@ -268,7 +266,7 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci, d->cmdPtr = OHCI1394_IsoRcvCommandPtr+32 *d->ctx; d->ctxMatch = OHCI1394_IsoRcvContextMatch+32 *d->ctx; - d->ir_prg =kmalloc (d->num_desc *sizeof (struct dma_cmd *), + d->ir_prg =kzalloc (d->num_desc *sizeof (struct dma_cmd *),GFP_KERNEL );if (d->ir_prg ==NULL ) {
@@ -276,7 +274,6 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci,free_dma_iso_ctx (d);return NULL ; } -memset (d->ir_prg,0 , d->num_desc *sizeof (struct dma_cmd *)); d->nb_cmd = d->buf_size /PAGE_SIZE +1 ; d->left_size = (d->frame_size % PAGE_SIZE) ?
@@ -297,7 +294,7 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci, d->ctrlClear = OHCI1394_IsoXmitContextControlClear+16 *d->ctx; d->cmdPtr = OHCI1394_IsoXmitCommandPtr+16 *d->ctx; - d->it_prg =kmalloc (d->num_desc *sizeof (struct it_dma_prg *), + d->it_prg =kzalloc (d->num_desc *sizeof (struct it_dma_prg *),GFP_KERNEL );if (d->it_prg ==NULL ) {
@@ -306,7 +303,6 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci,free_dma_iso_ctx (d);return NULL ; } -memset (d->it_prg,0 , d->num_desc*sizeof (struct it_dma_prg *)); d->packet_size = packet_size;
@@ -337,13 +333,13 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci, } } - d->buffer_status =kmalloc (d->num_desc *sizeof (unsigned int ), + d->buffer_status =kzalloc (d->num_desc *sizeof (unsigned int ),GFP_KERNEL ); - d->buffer_prg_assignment =kmalloc (d->num_desc *sizeof (unsigned int ), + d->buffer_prg_assignment =kzalloc (d->num_desc *sizeof (unsigned int ),GFP_KERNEL ); - d->buffer_time =kmalloc (d->num_desc *sizeof (struct timeval ), + d->buffer_time =kzalloc (d->num_desc *sizeof (struct timeval ),GFP_KERNEL ); - d->last_used_cmd =kmalloc (d->num_desc *sizeof (unsigned int ), + d->last_used_cmd =kzalloc (d->num_desc *sizeof (unsigned int ),GFP_KERNEL ); d->next_buffer =kmalloc (d->num_desc *sizeof (int ),GFP_KERNEL );
@@ -373,10 +369,6 @@ alloc_dma_iso_ctx(struct ti_ohci *ohci,free_dma_iso_ctx (d);return NULL ; } -memset (d->buffer_status,0 , d->num_desc *sizeof (unsigned int )); -memset (d->buffer_prg_assignment,0 , d->num_desc *sizeof (unsigned int )); -memset (d->buffer_time,0 , d->num_desc *sizeof (struct timeval )); -memset (d->last_used_cmd,0 , d->num_desc *sizeof (unsigned int ));memset (d->next_buffer,-1 , d->num_desc *sizeof (int ));spin_lock_init (&d->lock);
@@ -1251,13 +1243,12 @@ static int video1394_open(struct inode *if (ohci ==NULL )return -EIO ; - ctx =kmalloc (sizeof (struct file_ctx ),GFP_KERNEL ); + ctx =kzalloc (sizeof (struct file_ctx ),GFP_KERNEL );if (ctx ==NULL ) {KERN_ERR , ohci->host->id,"Cannot malloc file_ctx" );return -ENOMEM ; } -memset (ctx,0 ,sizeof (struct file_ctx )); ctx->ohci = ohci;INIT_LIST_HEAD (&ctx->context_list); ctx->current_ctx =NULL ;
---
0.99.9.GIT
Quoted 2 lines · Panagiotis Issaris
ieee1394: Conversions from kmalloc/memset to kzalloc.
Already in the -mm series, and will be submitted for 2.6.15. Pasted below for reference.
Cheers,
Jody
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 <[email protected]>
drivers/ieee1394/dv1394.c renamed from drivers/ieee1394+version/dv1394.c +1 -3
@@ -2218,14 +2218,12 @@ static int dv1394_init(struct ti_ohci *ounsigned long flags;int i; - video =kmalloc (sizeof (struct video_card ),GFP_KERNEL ); + video =kzalloc (sizeof (*video),GFP_KERNEL );if (!video) {printk (KERN_ERR "dv1394: cannot allocate video_card\n" ); goto err; } -memset (video,0 ,sizeof (struct video_card )); - video->ohci = ohci;/* lower 2 bits of id indicate which of four "plugs" per host */
drivers/ieee1394/eth1394.c renamed from drivers/ieee1394+version/eth1394.c +6 -6
@@ -352,12 +352,12 @@ static int eth1394_probe(struct device *if (!hi)return -ENOENT ; - new_node =kmalloc (sizeof (struct eth1394_node_ref ), + new_node =kmalloc (sizeof (*new_node),in_interrupt () ?GFP_ATOMIC :GFP_KERNEL );if (!new_node)return -ENOMEM ; - node_info =kmalloc (sizeof (struct eth1394_node_info ), + node_info =kmalloc (sizeof (*node_info),in_interrupt () ?GFP_ATOMIC :GFP_KERNEL );if (!node_info) {kfree (new_node);
@@ -433,12 +433,12 @@ static int eth1394_update(struct unit_di node =eth1394_find_node (&priv->ip_node_list, ud);if (!node) { - node =kmalloc (sizeof (struct eth1394_node_ref ), + node =kmalloc (sizeof (*node),in_interrupt () ?GFP_ATOMIC :GFP_KERNEL );if (!node)return -ENOMEM ; - node_info =kmalloc (sizeof (struct eth1394_node_info ), + node_info =kmalloc (sizeof (*node_info),in_interrupt () ?GFP_ATOMIC :GFP_KERNEL );if (!node_info) {kfree (node);
@@ -1014,7 +1014,7 @@ static inline int new_fragment(struct li } } - new =kmalloc (sizeof (struct fragment_info ),GFP_ATOMIC ); + new =kmalloc (sizeof (*new),GFP_ATOMIC );if (!new)return -ENOMEM ;
@@ -1033,7 +1033,7 @@ static inline int new_partial_datagram(s {struct partial_datagram *new; - new =kmalloc (sizeof (struct partial_datagram ),GFP_ATOMIC ); + new =kmalloc (sizeof (*new),GFP_ATOMIC );if (!new)return -ENOMEM ;
drivers/ieee1394/highlevel.c renamed from drivers/ieee1394+version/highlevel.c +6 -12
@@ -101,12 +101,10 @@ void *hpsb_create_hostinfo(struct hpsb_hreturn NULL ; } - hi =kmalloc (sizeof (*hi) + data_size,GFP_ATOMIC ); + hi =kzalloc (sizeof (*hi) + data_size,GFP_ATOMIC );if (!hi)return NULL ; -memset (hi,0 ,sizeof (*hi) + data_size); -if (data_size) { data = hi->data = hi +1 ; hi->size = data_size;
@@ -326,11 +324,9 @@ u64 hpsb_allocate_and_register_addrspacereturn retval; } - as = (struct hpsb_address_serve *) -kmalloc (sizeof (struct hpsb_address_serve ),GFP_KERNEL ); -if (as ==NULL ) { + as =kmalloc (sizeof (*as),GFP_KERNEL ); +if (!as)return retval; - }INIT_LIST_HEAD (&as->host_list);INIT_LIST_HEAD (&as->hl_list);
@@ -383,11 +379,9 @@ int hpsb_register_addrspace(struct hpsb_return 0 ; } - as = (struct hpsb_address_serve *) -kmalloc (sizeof (struct hpsb_address_serve ),GFP_ATOMIC ); -if (as ==NULL ) { -return 0 ; - } + as =kmalloc (sizeof (*as),GFP_ATOMIC ); +if (!as) +return 0 ;INIT_LIST_HEAD (&as->host_list);INIT_LIST_HEAD (&as->hl_list);
drivers/ieee1394/hosts.c renamed from drivers/ieee1394+version/hosts.c +3 -3
@@ -114,9 +114,9 @@ struct hpsb_host *hpsb_alloc_host(structint i;int hostnum =0 ; - h =kmalloc (sizeof (struct hpsb_host ) + extra,SLAB_KERNEL ); -if (!h)return NULL ; -memset (h,0 ,sizeof (struct hpsb_host ) + extra); + h =kzalloc (sizeof (*h) + extra,SLAB_KERNEL ); +if (!h) +return NULL ; h->csr.rom =csr1212_create_csr (&csr_bus_ops,CSR_BUS_INFO_SIZE , h);if (!h->csr.rom) {
drivers/ieee1394/nodemgr.c renamed from drivers/ieee1394+version/nodemgr.c +12 -15
@@ -743,21 +743,20 @@ static struct node_entry *nodemgr_create unsigned int generation) {struct hpsb_host *host = hi->host; -struct node_entry *ne; - - ne =kmalloc (sizeof (struct node_entry ),GFP_KERNEL ); -if (!ne)return NULL ; +struct node_entry *ne; -memset (ne,0 ,sizeof (struct node_entry )); + ne =kzalloc (sizeof (*ne),GFP_KERNEL ); +if (!ne) +return NULL ; ne->tpool = &host->tpool[nodeid &NODE_MASK ]; - ne->host = host; - ne->nodeid = nodeid; + ne->host = host; + ne->nodeid = nodeid; ne->generation = generation; ne->needs_probe =1 ; - ne->guid = guid; + ne->guid = guid; ne->guid_vendor_id = (guid >>40 ) &0xffffff ; ne->guid_vendor_oui =nodemgr_find_oui_name (ne->guid_vendor_id); ne->csr = csr;
@@ -787,7 +786,7 @@ static struct node_entry *nodemgr_create (host->node_id == nodeid) ?"Host" :"Node" , NODE_BUS_ARGS(host, nodeid), (unsigned long long)guid); -return ne; +return ne; }
@@ -872,12 +871,10 @@ static struct unit_directory *nodemgr_prstruct csr1212_keyval *kv;u8 last_key_id =0 ; - ud =kmalloc (sizeof (struct unit_directory ),GFP_KERNEL ); + ud =kzalloc (sizeof (*ud),GFP_KERNEL );if (!ud) goto unit_directory_error; -memset (ud,0 ,sizeof (struct unit_directory )); - ud->ne = ne; ud->ignore_driver = ignore_drivers; ud->address = ud_kv->offset +CSR1212_CONFIG_ROM_SPACE_BASE ;
@@ -937,10 +934,10 @@ static struct unit_directory *nodemgr_pr/* Logical Unit Number */ if (kv->key.type ==CSR1212_KV_TYPE_IMMEDIATE ) {if (ud->flags &UNIT_DIRECTORY_HAS_LUN ) { - ud_child =kmalloc (sizeof (struct unit_directory ),GFP_KERNEL ); + ud_child =kmalloc (sizeof (*ud_child),GFP_KERNEL );if (!ud_child) goto unit_directory_error; -memcpy (ud_child, ud,sizeof (struct unit_directory )); +memcpy (ud_child, ud,sizeof (*ud_child));nodemgr_register_device (ne, ud_child, &ne->device); ud_child =NULL ;
@@ -1200,7 +1197,7 @@ static void nodemgr_node_scan_one(structstruct csr1212_csr *csr;struct nodemgr_csr_info *ci; - ci =kmalloc (sizeof (struct nodemgr_csr_info ),GFP_KERNEL ); + ci =kmalloc (sizeof (*ci),GFP_KERNEL );if (!ci)return ;
drivers/ieee1394/ohci1394.c renamed from drivers/ieee1394+version/ohci1394.c +6 -14
@@ -2957,28 +2957,23 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, d->ctrlClear =0 ; d->cmdPtr =0 ; - d->buf_cpu =kmalloc (d->num_desc *sizeof (quadlet_t *),GFP_ATOMIC ); - d->buf_bus =kmalloc (d->num_desc *sizeof (dma_addr_t),GFP_ATOMIC ); + d->buf_cpu =kzalloc (d->num_desc *sizeof (*d->buf_cpu),GFP_ATOMIC ); + d->buf_bus =kzalloc (d->num_desc *sizeof (*d->buf_bus),GFP_ATOMIC );if (d->buf_cpu ==NULL || d->buf_bus ==NULL ) {KERN_ERR ,"Failed to allocate dma buffer" );free_dma_rcv_ctx (d);return -ENOMEM ; } -memset (d->buf_cpu,0 , d->num_desc *sizeof (quadlet_t *)); -memset (d->buf_bus,0 , d->num_desc *sizeof (dma_addr_t)); - d->prg_cpu =kmalloc (d->num_desc *sizeof (struct dma_cmd *), -GFP_ATOMIC ); - d->prg_bus =kmalloc (d->num_desc *sizeof (dma_addr_t),GFP_ATOMIC ); + d->prg_cpu =kzalloc (d->num_desc *sizeof (*d->prg_cpu),GFP_ATOMIC ); + d->prg_bus =kzalloc (d->num_desc *sizeof (*d->prg_bus),GFP_ATOMIC );if (d->prg_cpu ==NULL || d->prg_bus ==NULL ) {KERN_ERR ,"Failed to allocate dma prg" );free_dma_rcv_ctx (d);return -ENOMEM ; } -memset (d->prg_cpu,0 , d->num_desc *sizeof (struct dma_cmd *)); -memset (d->prg_bus,0 , d->num_desc *sizeof (dma_addr_t)); d->spb =kmalloc (d->split_buf_size,GFP_ATOMIC );
@@ -3090,17 +3085,14 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, d->ctrlClear =0 ; d->cmdPtr =0 ; - d->prg_cpu =kmalloc (d->num_desc *sizeof (struct at_dma_prg *), -GFP_KERNEL ); - d->prg_bus =kmalloc (d->num_desc *sizeof (dma_addr_t),GFP_KERNEL ); + d->prg_cpu =kzalloc (d->num_desc *sizeof (*d->prg_cpu),GFP_KERNEL ); + d->prg_bus =kzalloc (d->num_desc *sizeof (*d->prg_bus),GFP_KERNEL );if (d->prg_cpu ==NULL || d->prg_bus ==NULL ) {KERN_ERR ,"Failed to allocate at dma prg" );free_dma_trm_ctx (d);return -ENOMEM ; } -memset (d->prg_cpu,0 , d->num_desc *sizeof (struct at_dma_prg *)); -memset (d->prg_bus,0 , d->num_desc *sizeof (dma_addr_t)); len =sprintf (pool_name,"ohci1394_trm_prg" );sprintf (pool_name+len,"%d" , num_allocs);
drivers/ieee1394/pcilynx.c renamed from drivers/ieee1394+version/pcilynx.c +1 -1
@@ -1435,7 +1435,7 @@ static int __devinit add_card(struct pcistruct i2c_algo_bit_data i2c_adapter_data; error = -ENOMEM ; - i2c_ad =kmalloc (sizeof (struct i2c_adapter ),SLAB_KERNEL ); + i2c_ad =kmalloc (sizeof (*i2c_ad),SLAB_KERNEL );if (!i2c_ad)FAIL ("failed to allocate I2C adapter memory" );memcpy (i2c_ad, &bit_ops,sizeof (struct i2c_adapter ));
drivers/ieee1394/raw1394.c renamed from drivers/ieee1394+version/raw1394.c +16 -22
@@ -102,12 +102,9 @@ static struct pending_request *__alloc_p {struct pending_request *req; - req = (struct pending_request *)kmalloc (sizeof (struct pending_request ), - flags); -if (req !=NULL ) { -memset (req,0 ,sizeof (struct pending_request )); + req =kzalloc (sizeof (*req), flags); +if (req)INIT_LIST_HEAD (&req->list); - }return req; }
@@ -192,9 +189,9 @@ static void add_host(struct hpsb_host *hstruct host_info *hi;unsigned long flags; - hi = (struct host_info *)kmalloc (sizeof (struct host_info ),GFP_KERNEL ); + hi =kmalloc (sizeof (*hi),GFP_KERNEL ); -if (hi !=NULL ) { +if (hi) {INIT_LIST_HEAD (&hi->list); hi->host = host;INIT_LIST_HEAD (&hi->file_info_list);
@@ -315,8 +312,8 @@ static void iso_receive(struct hpsb_hostbreak ;if (!ibs) { - ibs =kmalloc (sizeof (struct iso_block_store ) - + length,SLAB_ATOMIC ); + ibs =kmalloc (sizeof (*ibs) + length, +SLAB_ATOMIC );if (!ibs) {kfree (req);break ;
@@ -376,8 +373,8 @@ static void fcp_request(struct hpsb_hostbreak ;if (!ibs) { - ibs =kmalloc (sizeof (struct iso_block_store ) - + length,SLAB_ATOMIC ); + ibs =kmalloc (sizeof (*ibs) + length, +SLAB_ATOMIC );if (!ibs) {kfree (req);break ;
@@ -502,10 +499,9 @@ static int state_initialized(struct fileswitch (req->req.type) {case RAW1394_REQ_LIST_CARDS :spin_lock_irqsave (&host_info_lock, flags); - khl =kmalloc (sizeof (struct raw1394_khost_list ) * host_count, -SLAB_ATOMIC ); + khl =kmalloc (sizeof (*khl) * host_count,SLAB_ATOMIC ); -if (khl !=NULL ) { +if (khl) { req->req.misc = host_count; req->data = (quadlet_t *) khl;
@@ -517,7 +513,7 @@ static int state_initialized(struct file }spin_unlock_irqrestore (&host_info_lock, flags); -if (khl !=NULL ) { +if (khl) { req->req.error =RAW1394_ERROR_NONE ; req->req.length = min(req->req.length, (u32) (sizeof
@@ -1647,13 +1643,13 @@ static int arm_register(struct file_inforeturn (-EINVAL ); }/* addr-list-entry for fileinfo */ - addr = (struct arm_addr *)kmalloc (sizeof (struct arm_addr ),SLAB_KERNEL ); + addr =kmalloc (sizeof (*addr),SLAB_KERNEL );if (!addr) { req->req.length =0 ;return (-ENOMEM ); }/* allocation of addr_space_buffer */ - addr->addr_space_buffer = (u8 *)vmalloc (req->req.length); + addr->addr_space_buffer =vmalloc (req->req.length);if (!(addr->addr_space_buffer)) {kfree (addr); req->req.length =0 ;
@@ -2122,8 +2118,7 @@ static int modify_config_rom(struct filereturn -ENOMEM ; } - cache->filled_head = -kmalloc (sizeof (struct csr1212_cache_region ),GFP_KERNEL ); + cache->filled_head =kmalloc (sizeof (*cache->filled_head),GFP_KERNEL );if (!cache->filled_head) {csr1212_release_keyval (fi->csr1212_dirs[dr]); fi->csr1212_dirs[dr] =NULL ;
@@ -2684,11 +2679,10 @@ static int raw1394_open(struct inode *in {struct file_info *fi; - fi =kmalloc (sizeof (struct file_info ),SLAB_KERNEL ); -if (fi ==NULL ) + fi =kzalloc (sizeof (*fi),SLAB_KERNEL ); +if (!fi)return -ENOMEM ; -memset (fi,0 ,sizeof (struct file_info )); fi->notification = (u8 )RAW1394_NOTIFY_ON ;/* busreset notification */ INIT_LIST_HEAD (&fi->list);
drivers/ieee1394/sbp2.c renamed from drivers/ieee1394+version/sbp2.c +2 -5
@@ -411,14 +411,12 @@ static int sbp2util_create_command_orb_pspin_lock_irqsave (&scsi_id->sbp2_command_orb_lock, flags);for (i =0 ; i < orbs; i++) { - command = (struct sbp2_command_info *) -kmalloc (sizeof (struct sbp2_command_info ),GFP_ATOMIC ); + command =kzalloc (sizeof (*command),GFP_ATOMIC );if (!command) {spin_unlock_irqrestore (&scsi_id->sbp2_command_orb_lock, flags);return -ENOMEM ; } -memset (command,'\0' ,sizeof (struct sbp2_command_info )); command->command_orb_dma = pci_map_single(hi->host->pdev, &command->command_orb, sizeof(struct sbp2_command_orb),
@@ -714,12 +712,11 @@ static struct scsi_id_instance_data *sbpSBP2_DEBUG ("sbp2_alloc_device" ); - scsi_id =kmalloc (sizeof (*scsi_id),GFP_KERNEL ); + scsi_id =kzalloc (sizeof (*scsi_id),GFP_KERNEL );if (!scsi_id) {SBP2_ERR ("failed to create scsi_id" ); goto failed_alloc; } -memset (scsi_id,0 ,sizeof (*scsi_id)); scsi_id->ne = ud->ne; scsi_id->ud = ud;
drivers/ieee1394/video1394.c renamed from drivers/ieee1394+version/video1394.c +26 -55
147 lines not on this page · raw message
drivers/ieee1394/csr1212.c renamed from drivers/ieee1394+kzalloc/csr1212.c +5 -6
@@ -1261,7 +1261,7 @@ static int csr1212_parse_bus_info_block(return CSR1212_EINVAL ;#endif - cr =CSR1212_MALLOC (sizeof (struct csr1212_cache_region )); + cr =CSR1212_MALLOC (sizeof (*cr));if (!cr)return CSR1212_ENOMEM ;
@@ -1393,8 +1393,7 @@ int csr1212_parse_keyval(struct csr1212_case CSR1212_KV_TYPE_LEAF :if (kv->key.id !=CSR1212_KV_ID_EXTENDED_ROM ) { kv->value.leaf.data =CSR1212_MALLOC (quads_to_bytes (kvi_len)); -if (!kv->value.leaf.data) - { +if (!kv->value.leaf.data) { ret =CSR1212_ENOMEM ; goto fail; }
@@ -1462,7 +1461,7 @@ int _csr1212_read_keyval(struct csr1212_ cache->next =NULL ; csr->cache_tail = cache; cache->filled_head = -CSR1212_MALLOC (sizeof (struct csr1212_cache_region )); +CSR1212_MALLOC (sizeof (*cache->filled_head));if (!cache->filled_head) {return CSR1212_ENOMEM ; }
@@ -1484,7 +1483,7 @@ int _csr1212_read_keyval(struct csr1212_/* Now seach read portions of the cache to see if it is there. */ for (cr = cache->filled_head; cr; cr = cr->next) {if (cache_index < cr->offset_start) { - newcr =CSR1212_MALLOC (sizeof (struct csr1212_cache_region )); + newcr =CSR1212_MALLOC (sizeof (*newcr));if (!newcr)return CSR1212_ENOMEM ;
@@ -1508,7 +1507,7 @@ int _csr1212_read_keyval(struct csr1212_if (!cr) { cr = cache->filled_tail; - newcr =CSR1212_MALLOC (sizeof (struct csr1212_cache_region )); + newcr =CSR1212_MALLOC (sizeof (*newcr));if (!newcr)return CSR1212_ENOMEM ;
drivers/ieee1394/csr1212.h renamed from drivers/ieee1394+kzalloc/csr1212.h +1 -1
@@ -646,7 +646,7 @@ static inline struct csr1212_csr_rom_cac {struct csr1212_csr_rom_cache *cache; - cache =CSR1212_MALLOC (sizeof (struct csr1212_csr_rom_cache ) + size); + cache =CSR1212_MALLOC (sizeof (*cache) + size);if (!cache)return NULL ;