提交 52fd9108 编写于 作者: Y Yan Burman 提交者: Tony Luck

[IA64] replace kmalloc+memset with kzalloc

Replace kmalloc+memset with kzalloc
Signed-off-by: NYan Burman <burman.yan@gmail.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NTony Luck <tony.luck@intel.com>
上级 66888a6e
...@@ -1672,15 +1672,13 @@ ioc_sac_init(struct ioc *ioc) ...@@ -1672,15 +1672,13 @@ ioc_sac_init(struct ioc *ioc)
* SAC (single address cycle) addressable, so allocate a * SAC (single address cycle) addressable, so allocate a
* pseudo-device to enforce that. * pseudo-device to enforce that.
*/ */
sac = kmalloc(sizeof(*sac), GFP_KERNEL); sac = kzalloc(sizeof(*sac), GFP_KERNEL);
if (!sac) if (!sac)
panic(PFX "Couldn't allocate struct pci_dev"); panic(PFX "Couldn't allocate struct pci_dev");
memset(sac, 0, sizeof(*sac));
controller = kmalloc(sizeof(*controller), GFP_KERNEL); controller = kzalloc(sizeof(*controller), GFP_KERNEL);
if (!controller) if (!controller)
panic(PFX "Couldn't allocate struct pci_controller"); panic(PFX "Couldn't allocate struct pci_controller");
memset(controller, 0, sizeof(*controller));
controller->iommu = ioc; controller->iommu = ioc;
sac->sysdata = controller; sac->sysdata = controller;
...@@ -1737,12 +1735,10 @@ ioc_init(u64 hpa, void *handle) ...@@ -1737,12 +1735,10 @@ ioc_init(u64 hpa, void *handle)
struct ioc *ioc; struct ioc *ioc;
struct ioc_iommu *info; struct ioc_iommu *info;
ioc = kmalloc(sizeof(*ioc), GFP_KERNEL); ioc = kzalloc(sizeof(*ioc), GFP_KERNEL);
if (!ioc) if (!ioc)
return NULL; return NULL;
memset(ioc, 0, sizeof(*ioc));
ioc->next = ioc_list; ioc->next = ioc_list;
ioc_list = ioc; ioc_list = ioc;
......
...@@ -684,12 +684,11 @@ static int get_async_struct(int line, struct async_struct **ret_info) ...@@ -684,12 +684,11 @@ static int get_async_struct(int line, struct async_struct **ret_info)
*ret_info = sstate->info; *ret_info = sstate->info;
return 0; return 0;
} }
info = kmalloc(sizeof(struct async_struct), GFP_KERNEL); info = kzalloc(sizeof(struct async_struct), GFP_KERNEL);
if (!info) { if (!info) {
sstate->count--; sstate->count--;
return -ENOMEM; return -ENOMEM;
} }
memset(info, 0, sizeof(struct async_struct));
init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->open_wait);
init_waitqueue_head(&info->close_wait); init_waitqueue_head(&info->close_wait);
init_waitqueue_head(&info->delta_msr_wait); init_waitqueue_head(&info->delta_msr_wait);
......
...@@ -853,9 +853,8 @@ pfm_context_alloc(void) ...@@ -853,9 +853,8 @@ pfm_context_alloc(void)
* allocate context descriptor * allocate context descriptor
* must be able to free with interrupts disabled * must be able to free with interrupts disabled
*/ */
ctx = kmalloc(sizeof(pfm_context_t), GFP_KERNEL); ctx = kzalloc(sizeof(pfm_context_t), GFP_KERNEL);
if (ctx) { if (ctx) {
memset(ctx, 0, sizeof(pfm_context_t));
DPRINT(("alloc ctx @%p\n", ctx)); DPRINT(("alloc ctx @%p\n", ctx));
} }
return ctx; return ctx;
......
...@@ -125,11 +125,10 @@ alloc_pci_controller (int seg) ...@@ -125,11 +125,10 @@ alloc_pci_controller (int seg)
{ {
struct pci_controller *controller; struct pci_controller *controller;
controller = kmalloc(sizeof(*controller), GFP_KERNEL); controller = kzalloc(sizeof(*controller), GFP_KERNEL);
if (!controller) if (!controller)
return NULL; return NULL;
memset(controller, 0, sizeof(*controller));
controller->segment = seg; controller->segment = seg;
controller->node = -1; controller->node = -1;
return controller; return controller;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册