diff options
| author | Julia Lawall <julia@diku.dk> | 2010-05-13 15:58:37 -0400 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2010-05-17 02:12:44 -0400 |
| commit | 550a8b691ca67761bbf382d98fbd81d215f1d7f0 (patch) | |
| tree | ffa575dee79ce5ae6ce8a358b9599d2cb309aef8 | |
| parent | 1be1d76b8a1f622fd3a64778dfe117053f2af1f2 (diff) | |
ALSA: sound/pci/asihpi: Use kzalloc
Use kzalloc rather than the combination of kmalloc and memset.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,size,flags;
statement S;
@@
-x = kmalloc(size,flags);
+x = kzalloc(size,flags);
if (x == NULL) S
-memset(x, 0, size);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/pci/asihpi/hpi6000.c | 3 | ||||
| -rw-r--r-- | sound/pci/asihpi/hpi6205.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c index 9c50931731a5..839ecb2e4b64 100644 --- a/sound/pci/asihpi/hpi6000.c +++ b/sound/pci/asihpi/hpi6000.c | |||
| @@ -448,14 +448,13 @@ static void subsys_create_adapter(struct hpi_message *phm, | |||
| 448 | if (phm->u.s.resource.r.pci->device_id != HPI_PCI_DEV_ID_PCI2040) | 448 | if (phm->u.s.resource.r.pci->device_id != HPI_PCI_DEV_ID_PCI2040) |
| 449 | return; | 449 | return; |
| 450 | 450 | ||
| 451 | ao.priv = kmalloc(sizeof(struct hpi_hw_obj), GFP_KERNEL); | 451 | ao.priv = kzalloc(sizeof(struct hpi_hw_obj), GFP_KERNEL); |
| 452 | if (!ao.priv) { | 452 | if (!ao.priv) { |
| 453 | HPI_DEBUG_LOG(ERROR, "cant get mem for adapter object\n"); | 453 | HPI_DEBUG_LOG(ERROR, "cant get mem for adapter object\n"); |
| 454 | phr->error = HPI_ERROR_MEMORY_ALLOC; | 454 | phr->error = HPI_ERROR_MEMORY_ALLOC; |
| 455 | return; | 455 | return; |
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | memset(ao.priv, 0, sizeof(struct hpi_hw_obj)); | ||
| 459 | /* create the adapter object based on the resource information */ | 458 | /* create the adapter object based on the resource information */ |
| 460 | /*? memcpy(&ao.Pci,&phm->u.s.Resource.r.Pci,sizeof(ao.Pci)); */ | 459 | /*? memcpy(&ao.Pci,&phm->u.s.Resource.r.Pci,sizeof(ao.Pci)); */ |
| 461 | ao.pci = *phm->u.s.resource.r.pci; | 460 | ao.pci = *phm->u.s.resource.r.pci; |
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c index 8df2ff76d944..5e88c1fc2b9e 100644 --- a/sound/pci/asihpi/hpi6205.c +++ b/sound/pci/asihpi/hpi6205.c | |||
| @@ -482,13 +482,12 @@ static void subsys_create_adapter(struct hpi_message *phm, | |||
| 482 | if (phm->u.s.resource.r.pci->device_id != HPI_PCI_DEV_ID_DSP6205) | 482 | if (phm->u.s.resource.r.pci->device_id != HPI_PCI_DEV_ID_DSP6205) |
| 483 | return; | 483 | return; |
| 484 | 484 | ||
| 485 | ao.priv = kmalloc(sizeof(struct hpi_hw_obj), GFP_KERNEL); | 485 | ao.priv = kzalloc(sizeof(struct hpi_hw_obj), GFP_KERNEL); |
| 486 | if (!ao.priv) { | 486 | if (!ao.priv) { |
| 487 | HPI_DEBUG_LOG(ERROR, "cant get mem for adapter object\n"); | 487 | HPI_DEBUG_LOG(ERROR, "cant get mem for adapter object\n"); |
| 488 | phr->error = HPI_ERROR_MEMORY_ALLOC; | 488 | phr->error = HPI_ERROR_MEMORY_ALLOC; |
| 489 | return; | 489 | return; |
| 490 | } | 490 | } |
| 491 | memset(ao.priv, 0, sizeof(struct hpi_hw_obj)); | ||
| 492 | 491 | ||
| 493 | ao.pci = *phm->u.s.resource.r.pci; | 492 | ao.pci = *phm->u.s.resource.r.pci; |
| 494 | err = create_adapter_obj(&ao, &os_error_code); | 493 | err = create_adapter_obj(&ao, &os_error_code); |
