Commit 88abaab4 authored by Eric Sesterhenn's avatar Eric Sesterhenn Committed by Linus Torvalds
Browse files

[PATCH] s390: kzalloc() conversion in drivers/s390


Convert all kmalloc + memset sequences in drivers/s390 to kzalloc usage.
Signed-off-by: default avatarEric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent fb630517
......@@ -71,10 +71,9 @@ dasd_alloc_device(void)
{
struct dasd_device *device;
device = kmalloc(sizeof (struct dasd_device), GFP_ATOMIC);
device = kzalloc(sizeof (struct dasd_device), GFP_ATOMIC);
if (device == NULL)
return ERR_PTR(-ENOMEM);
memset(device, 0, sizeof (struct dasd_device));
/* open_count = 0 means device online but not in use */
atomic_set(&device->open_count, -1);
......@@ -547,29 +546,26 @@ dasd_kmalloc_request(char *magic, int cplength, int datasize,
(cplength*sizeof(struct ccw1)) > PAGE_SIZE)
BUG();
cqr = kmalloc(sizeof(struct dasd_ccw_req), GFP_ATOMIC);
cqr = kzalloc(sizeof(struct dasd_ccw_req), GFP_ATOMIC);
if (cqr == NULL)
return ERR_PTR(-ENOMEM);
memset(cqr, 0, sizeof(struct dasd_ccw_req));
cqr->cpaddr = NULL;
if (cplength > 0) {
cqr->cpaddr = kmalloc(cplength*sizeof(struct ccw1),
cqr->cpaddr = kcalloc(cplength, sizeof(struct ccw1),
GFP_ATOMIC | GFP_DMA);
if (cqr->cpaddr == NULL) {
kfree(cqr);
return ERR_PTR(-ENOMEM);
}
memset(cqr->cpaddr, 0, cplength*sizeof(struct ccw1));
}
cqr->data = NULL;
if (datasize > 0) {
cqr->data = kmalloc(datasize, GFP_ATOMIC | GFP_DMA);
cqr->data = kzalloc(datasize, GFP_ATOMIC | GFP_DMA);
if (cqr->data == NULL) {
kfree(cqr->cpaddr);
kfree(cqr);
return ERR_PTR(-ENOMEM);
}
memset(cqr->data, 0, datasize);
}
strncpy((char *) &cqr->magic, magic, 4);
ASCEBC((char *) &cqr->magic, 4);
......
......@@ -388,12 +388,11 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
/*
* get a struct dcssblk_dev_info
*/
dev_info = kmalloc(sizeof(struct dcssblk_dev_info), GFP_KERNEL);
dev_info = kzalloc(sizeof(struct dcssblk_dev_info), GFP_KERNEL);
if (dev_info == NULL) {
rc = -ENOMEM;
goto out;
}
memset(dev_info, 0, sizeof(struct dcssblk_dev_info));
strcpy(dev_info->segment_name, local_buf);
strlcpy(dev_info->dev.bus_id, local_buf, BUS_ID_SIZE);
......
......@@ -368,10 +368,9 @@ fs3270_alloc_view(void)
{
struct fs3270 *fp;
fp = (struct fs3270 *) kmalloc(sizeof(struct fs3270),GFP_KERNEL);
fp = kzalloc(sizeof(struct fs3270),GFP_KERNEL);
if (!fp)
return ERR_PTR(-ENOMEM);
memset(fp, 0, sizeof(struct fs3270));
fp->init = raw3270_request_alloc(0);
if (IS_ERR(fp->init)) {
kfree(fp);
......
......@@ -50,14 +50,12 @@ kbd_alloc(void) {
struct kbd_data *kbd;
int i, len;
kbd = kmalloc(sizeof(struct kbd_data), GFP_KERNEL);
kbd = kzalloc(sizeof(struct kbd_data), GFP_KERNEL);
if (!kbd)
goto out;
memset(kbd, 0, sizeof(struct kbd_data));
kbd->key_maps = kmalloc(sizeof(key_maps), GFP_KERNEL);
kbd->key_maps = kzalloc(sizeof(key_maps), GFP_KERNEL);
if (!key_maps)
goto out_kbd;
memset(kbd->key_maps, 0, sizeof(key_maps));
for (i = 0; i < ARRAY_SIZE(key_maps); i++) {
if (key_maps[i]) {
kbd->key_maps[i] =
......@@ -68,10 +66,9 @@ kbd_alloc(void) {
sizeof(u_short)*NR_KEYS);
}
}
kbd->func_table = kmalloc(sizeof(func_table), GFP_KERNEL);
kbd->func_table = kzalloc(sizeof(func_table), GFP_KERNEL);
if (!kbd->func_table)
goto out_maps;
memset(kbd->func_table, 0, sizeof(func_table));
for (i = 0; i < ARRAY_SIZE(func_table); i++) {
if (func_table[i]) {
len = strlen(func_table[i]) + 1;
......@@ -82,10 +79,9 @@ kbd_alloc(void) {
}
}
kbd->fn_handler =
kmalloc(sizeof(fn_handler_fn *) * NR_FN_HANDLER, GFP_KERNEL);
kzalloc(sizeof(fn_handler_fn *) * NR_FN_HANDLER, GFP_KERNEL);
if (!kbd->fn_handler)
goto out_func;
memset(kbd->fn_handler, 0, sizeof(fn_handler_fn *) * NR_FN_HANDLER);
kbd->accent_table =
kmalloc(sizeof(struct kbdiacr)*MAX_DIACR, GFP_KERNEL);
if (!kbd->accent_table)
......
......@@ -257,14 +257,13 @@ mon_alloc_mem(void)
int i,j;
struct mon_private *monpriv;
monpriv = kmalloc(sizeof(struct mon_private), GFP_KERNEL);
monpriv = kzalloc(sizeof(struct mon_private), GFP_KERNEL);
if (!monpriv) {
P_ERROR("no memory for monpriv\n");
return NULL;
}
memset(monpriv, 0, sizeof(struct mon_private));
for (i = 0; i < MON_MSGLIM; i++) {
monpriv->msg_array[i] = kmalloc(sizeof(struct mon_msg),
monpriv->msg_array[i] = kzalloc(sizeof(struct mon_msg),
GFP_KERNEL);
if (!monpriv->msg_array[i]) {
P_ERROR("open, no memory for msg_array\n");
......@@ -272,7 +271,6 @@ mon_alloc_mem(void)
kfree(monpriv->msg_array[j]);
return NULL;
}
memset(monpriv->msg_array[i], 0, sizeof(struct mon_msg));
}
return monpriv;
}
......
......@@ -115,10 +115,9 @@ raw3270_request_alloc(size_t size)
struct raw3270_request *rq;
/* Allocate request structure */
rq = kmalloc(sizeof(struct raw3270_request), GFP_KERNEL | GFP_DMA);
rq = kzalloc(sizeof(struct raw3270_request), GFP_KERNEL | GFP_DMA);
if (!rq)
return ERR_PTR(-ENOMEM);
memset(rq, 0, sizeof(struct raw3270_request));
/* alloc output buffer. */
if (size > 0) {
......
......@@ -44,11 +44,10 @@ struct tape_class_device *register_tape_dev(
int rc;
char * s;
tcd = kmalloc(sizeof(struct tape_class_device), GFP_KERNEL);
tcd = kzalloc(sizeof(struct tape_class_device), GFP_KERNEL);
if (!tcd)
return ERR_PTR(-ENOMEM);
memset(tcd, 0, sizeof(struct tape_class_device));
strncpy(tcd->device_name, device_name, TAPECLASS_NAME_LEN);
for (s = strchr(tcd->device_name, '/'); s; s = strchr(s, '/'))
*s = '!';
......
......@@ -453,16 +453,14 @@ tape_alloc_device(void)
{
struct tape_device *device;
device = (struct tape_device *)
kmalloc(sizeof(struct tape_device), GFP_KERNEL);
device = kzalloc(sizeof(struct tape_device), GFP_KERNEL);
if (device == NULL) {
DBF_EXCEPTION(2, "ti:no mem\n");
PRINT_INFO ("can't allocate memory for "
"tape info structure\n");
return ERR_PTR(-ENOMEM);
}
memset(device, 0, sizeof(struct tape_device));
device->modeset_byte = (char *) kmalloc(1, GFP_KERNEL | GFP_DMA);
device->modeset_byte = kmalloc(1, GFP_KERNEL | GFP_DMA);
if (device->modeset_byte == NULL) {
DBF_EXCEPTION(2, "ti:no mem\n");
PRINT_INFO("can't allocate memory for modeset byte\n");
......@@ -659,34 +657,30 @@ tape_alloc_request(int cplength, int datasize)
DBF_LH(6, "tape_alloc_request(%d, %d)\n", cplength, datasize);
request = (struct tape_request *) kmalloc(sizeof(struct tape_request),
GFP_KERNEL);
request = kzalloc(sizeof(struct tape_request), GFP_KERNEL);
if (request == NULL) {
DBF_EXCEPTION(1, "cqra nomem\n");
return ERR_PTR(-ENOMEM);
}
memset(request, 0, sizeof(struct tape_request));
/* allocate channel program */
if (cplength > 0) {
request->cpaddr = kmalloc(cplength*sizeof(struct ccw1),
request->cpaddr = kcalloc(cplength, sizeof(struct ccw1),
GFP_ATOMIC | GFP_DMA);
if (request->cpaddr == NULL) {
DBF_EXCEPTION(1, "cqra nomem\n");
kfree(request);
return ERR_PTR(-ENOMEM);
}
memset(request->cpaddr, 0, cplength*sizeof(struct ccw1));
}
/* alloc small kernel buffer */
if (datasize > 0) {
request->cpdata = kmalloc(datasize, GFP_KERNEL | GFP_DMA);
request->cpdata = kzalloc(datasize, GFP_KERNEL | GFP_DMA);
if (request->cpdata == NULL) {
DBF_EXCEPTION(1, "cqra nomem\n");
kfree(request->cpaddr);
kfree(request);
return ERR_PTR(-ENOMEM);
}
memset(request->cpdata, 0, datasize);
}
DBF_LH(6, "New request %p(%p/%p)\n", request, request->cpaddr,
request->cpdata);
......
......@@ -691,10 +691,9 @@ tty3270_alloc_view(void)
struct tty3270 *tp;
int pages;
tp = kmalloc(sizeof(struct tty3270),GFP_KERNEL);
tp = kzalloc(sizeof(struct tty3270), GFP_KERNEL);
if (!tp)
goto out_err;
memset(tp, 0, sizeof(struct tty3270));
tp->freemem_pages =
kmalloc(sizeof(void *) * TTY3270_STRING_PAGES, GFP_KERNEL);
if (!tp->freemem_pages)
......@@ -767,16 +766,14 @@ tty3270_alloc_screen(struct tty3270 *tp)
int lines;
size = sizeof(struct tty3270_line) * (tp->view.rows - 2);
tp->screen = kmalloc(size, GFP_KERNEL);
tp->screen = kzalloc(size, GFP_KERNEL);
if (!tp->screen)
goto out_err;
memset(tp->screen, 0, size);
for (lines = 0; lines < tp->view.rows - 2; lines++) {
size = sizeof(struct tty3270_cell) * tp->view.cols;
tp->screen[lines].cells = kmalloc(size, GFP_KERNEL);
tp->screen[lines].cells = kzalloc(size, GFP_KERNEL);
if (!tp->screen[lines].cells)
goto out_screen;
memset(tp->screen[lines].cells, 0, size);
}
return 0;
out_screen:
......
......@@ -759,9 +759,8 @@ vmlogrdr_register_device(struct vmlogrdr_priv_t *priv) {
struct device *dev;
int ret;
dev = kmalloc(sizeof(struct device), GFP_KERNEL);
dev = kzalloc(sizeof(struct device), GFP_KERNEL);
if (dev) {
memset(dev, 0, sizeof(struct device));
snprintf(dev->bus_id, BUS_ID_SIZE, "%s",
priv->internal_name);
dev->bus = &iucv_bus;
......
......@@ -157,11 +157,10 @@ ccwgroup_create(struct device *root,
if (argc > 256) /* disallow dumb users */
return -EINVAL;
gdev = kmalloc(sizeof(*gdev) + argc*sizeof(gdev->cdev[0]), GFP_KERNEL);
gdev = kzalloc(sizeof(*gdev) + argc*sizeof(gdev->cdev[0]), GFP_KERNEL);
if (!gdev)
return -ENOMEM;
memset(gdev, 0, sizeof(*gdev) + argc*sizeof(gdev->cdev[0]));
atomic_set(&gdev->onoff, 0);
del_drvdata = 0;
......
......@@ -1403,10 +1403,9 @@ new_channel_path(int chpid)
struct channel_path *chp;
int ret;
chp = kmalloc(sizeof(struct channel_path), GFP_KERNEL);
chp = kzalloc(sizeof(struct channel_path), GFP_KERNEL);
if (!chp)
return -ENOMEM;
memset(chp, 0, sizeof(struct channel_path));
/* fill in status, etc. */
chp->id = chpid;
......
......@@ -630,10 +630,9 @@ css_enqueue_subchannel_slow(struct subchannel_id schid)
struct slow_subchannel *new_slow_sch;
unsigned long flags;
new_slow_sch = kmalloc(sizeof(struct slow_subchannel), GFP_ATOMIC);
new_slow_sch = kzalloc(sizeof(struct slow_subchannel), GFP_ATOMIC);
if (!new_slow_sch)
return -ENOMEM;
memset(new_slow_sch, 0, sizeof(struct slow_subchannel));
new_slow_sch->schid = schid;
spin_lock_irqsave(&slow_subchannel_lock, flags);
list_add_tail(&new_slow_sch->slow_list, &slow_subchannels_head);
......
......@@ -826,17 +826,15 @@ io_subchannel_probe (struct subchannel *sch)
get_device(&cdev->dev);
return 0;
}
cdev = kmalloc (sizeof(*cdev), GFP_KERNEL);
cdev = kzalloc (sizeof(*cdev), GFP_KERNEL);
if (!cdev)
return -ENOMEM;
memset(cdev, 0, sizeof(struct ccw_device));
cdev->private = kmalloc(sizeof(struct ccw_device_private),
cdev->private = kzalloc(sizeof(struct ccw_device_private),
GFP_KERNEL | GFP_DMA);
if (!cdev->private) {
kfree(cdev);
return -ENOMEM;
}
memset(cdev->private, 0, sizeof(struct ccw_device_private));
atomic_set(&cdev->private->onoff, 0);
cdev->dev = (struct device) {
.parent = &sch->dev,
......
......@@ -359,10 +359,9 @@ read_dev_chars (struct ccw_device *cdev, void **buffer, int length)
CIO_TRACE_EVENT (4, "rddevch");
CIO_TRACE_EVENT (4, sch->dev.bus_id);
rdc_ccw = kmalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
rdc_ccw = kzalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
if (!rdc_ccw)
return -ENOMEM;
memset(rdc_ccw, 0, sizeof(struct ccw1));
rdc_ccw->cmd_code = CCW_CMD_RDC;
rdc_ccw->count = length;
rdc_ccw->flags = CCW_FLAG_SLI;
......@@ -426,16 +425,14 @@ read_conf_data_lpm (struct ccw_device *cdev, void **buffer, int *length, __u8 lp
if (!ciw || ciw->cmd == 0)
return -EOPNOTSUPP;
rcd_ccw = kmalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
rcd_ccw = kzalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
if (!rcd_ccw)
return -ENOMEM;
memset(rcd_ccw, 0, sizeof(struct ccw1));
rcd_buf = kmalloc(ciw->count, GFP_KERNEL | GFP_DMA);
rcd_buf = kzalloc(ciw->count, GFP_KERNEL | GFP_DMA);
if (!rcd_buf) {
kfree(rcd_ccw);
return -ENOMEM;
}
memset (rcd_buf, 0, ciw->count);
rcd_ccw->cmd_code = ciw->cmd;
rcd_ccw->cda = (__u32) __pa (rcd_buf);
rcd_ccw->count = ciw->count;
......
......@@ -1686,16 +1686,14 @@ qdio_alloc_qs(struct qdio_irq *irq_ptr,
int result=-ENOMEM;
for (i=0;i<no_input_qs;i++) {
q=kmalloc(sizeof(struct qdio_q),GFP_KERNEL);
q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL);
if (!q) {
QDIO_PRINT_ERR("kmalloc of q failed!\n");
goto out;
}
memset(q,0,sizeof(struct qdio_q));
q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL);
q->slib = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!q->slib) {
QDIO_PRINT_ERR("kmalloc of slib failed!\n");
goto out;
......@@ -1705,14 +1703,12 @@ qdio_alloc_qs(struct qdio_irq *irq_ptr,
}
for (i=0;i<no_output_qs;i++) {
q=kmalloc(sizeof(struct qdio_q),GFP_KERNEL);
q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL);
if (!q) {
goto out;
}
memset(q,0,sizeof(struct qdio_q));
q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL);
if (!q->slib) {
QDIO_PRINT_ERR("kmalloc of slib failed!\n");
......@@ -2984,7 +2980,7 @@ qdio_allocate(struct qdio_initialize *init_data)
qdio_allocate_do_dbf(init_data);
/* create irq */
irq_ptr=kmalloc(sizeof(struct qdio_irq), GFP_KERNEL | GFP_DMA);
irq_ptr = kzalloc(sizeof(struct qdio_irq), GFP_KERNEL | GFP_DMA);
QDIO_DBF_TEXT0(0,setup,"irq_ptr:");
QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*));
......@@ -2994,8 +2990,6 @@ qdio_allocate(struct qdio_initialize *init_data)
return -ENOMEM;
}
memset(irq_ptr,0,sizeof(struct qdio_irq));
init_MUTEX(&irq_ptr->setting_up_sema);
/* QDR must be in DMA area since CCW data address is only 32 bit */
......@@ -3686,10 +3680,10 @@ qdio_get_qdio_memory(void)
for (i=1;i<INDICATORS_PER_CACHELINE;i++)
indicator_used[i]=0;
indicators=(__u32*)kmalloc(sizeof(__u32)*(INDICATORS_PER_CACHELINE),
indicators = kzalloc(sizeof(__u32)*(INDICATORS_PER_CACHELINE),
GFP_KERNEL);
if (!indicators) return -ENOMEM;
memset(indicators,0,sizeof(__u32)*(INDICATORS_PER_CACHELINE));
if (!indicators)
return -ENOMEM;
return 0;
}
......
......@@ -707,13 +707,12 @@ z90crypt_open(struct inode *inode, struct file *filp)
if (quiesce_z90crypt)
return -EQUIESCE;
private_data_p = kmalloc(sizeof(struct priv_data), GFP_KERNEL);
private_data_p = kzalloc(sizeof(struct priv_data), GFP_KERNEL);
if (!private_data_p) {
PRINTK("Memory allocate failed\n");
return -ENOMEM;
}
memset((void *)private_data_p, 0, sizeof(struct priv_data));
private_data_p->status = STAT_OPEN;
private_data_p->opener_pid = PID();
filp->private_data = private_data_p;
......@@ -2737,13 +2736,11 @@ create_z90crypt(int *cdx_p)
z90crypt.max_count = Z90CRYPT_NUM_DEVS;
z90crypt.cdx = *cdx_p;
hdware_blk_p = (struct hdware_block *)
kmalloc(sizeof(struct hdware_block), GFP_ATOMIC);
hdware_blk_p = kzalloc(sizeof(struct hdware_block), GFP_ATOMIC);
if (!hdware_blk_p) {
PDEBUG("kmalloc for hardware block failed\n");
return ENOMEM;
}
memset(hdware_blk_p, 0x00, sizeof(struct hdware_block));
z90crypt.hdware_info = hdware_blk_p;
return 0;
......@@ -2978,12 +2975,11 @@ create_crypto_device(int index)
total_size = sizeof(struct device) +
z90crypt.q_depth_array[index] * sizeof(int);
dev_ptr = (struct device *) kmalloc(total_size, GFP_ATOMIC);
dev_ptr = kzalloc(total_size, GFP_ATOMIC);
if (!dev_ptr) {
PRINTK("kmalloc device %d failed\n", index);
return ENOMEM;
}
memset(dev_ptr, 0, total_size);
dev_ptr->dev_resp_p = kmalloc(MAX_RESPONSE_SIZE, GFP_ATOMIC);
if (!dev_ptr->dev_resp_p) {
kfree(dev_ptr);
......
......@@ -310,7 +310,7 @@ claw_probe(struct ccwgroup_device *cgdev)
printk(KERN_INFO "claw: variable cgdev =\n");
dumpit((char *)cgdev, sizeof(struct ccwgroup_device));
#endif
privptr = kmalloc(sizeof(struct claw_privbk), GFP_KERNEL);
privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL);
if (privptr == NULL) {
probe_error(cgdev);
put_device(&cgdev->dev);
......@@ -319,7 +319,6 @@ claw_probe(struct ccwgroup_device *cgdev)
CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM);
return -ENOMEM;
}
memset(privptr,0x00,sizeof(struct claw_privbk));
privptr->p_mtc_envelope= kmalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL);
privptr->p_env = kmalloc(sizeof(struct claw_env), GFP_KERNEL);
if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) {
......
......@@ -21,38 +21,34 @@ init_fsm(char *name, const char **state_names, const char **event_names, int nr_
fsm_function_t *m;
fsm *f;
this = (fsm_instance *)kmalloc(sizeof(fsm_instance), order);
this = kzalloc(sizeof(fsm_instance), order);
if (this == NULL) {
printk(KERN_WARNING
"fsm(%s): init_fsm: Couldn't alloc instance\n", name);
return NULL;
}
memset(this, 0, sizeof(fsm_instance));
strlcpy(this->name, name, sizeof(this->name));
f = (fsm *)kmalloc(sizeof(fsm), order);
f = kzalloc(sizeof(fsm), order);
if (f == NULL) {
printk(KERN_WARNING
"fsm(%s): init_fsm: Couldn't alloc fsm\n", name);
kfree_fsm(this);
return NULL;
}
memset(f, 0, sizeof(fsm));
f->nr_events = nr_events;
f->nr_states = nr_states;
f->event_names = event_names;
f->state_names = state_names;
this->f = f;
m = (fsm_function_t *)kmalloc(
sizeof(fsm_function_t) * nr_states * nr_events, order);
m = kcalloc(nr_states*nr_events, sizeof(fsm_function_t), order);
if (m == NULL) {
printk(KERN_WARNING
"fsm(%s): init_fsm: Couldn't alloc jumptable\n", name);
kfree_fsm(this);
return NULL;
}
memset(m, 0, sizeof(fsm_function_t) * f->nr_states * f->nr_events);
f->jumpmatrix = m;
for (i = 0; i < tmpl_len; i++) {
......
......@@ -386,7 +386,7 @@ iucv_init(void)
}
/* Note: GFP_DMA used used to get memory below 2G */
iucv_external_int_buffer = kmalloc(sizeof(iucv_GeneralInterrupt),
iucv_external_int_buffer = kzalloc(sizeof(iucv_GeneralInterrupt),
GFP_KERNEL|GFP_DMA);
if (!iucv_external_int_buffer) {
printk(KERN_WARNING
......@@ -396,10 +396,9 @@ iucv_init(void)
bus_unregister(&iucv_bus);
return -ENOMEM;
}
memset(iucv_external_int_buffer, 0, sizeof(iucv_GeneralInterrupt));
/* Initialize parameter pool */
iucv_param_pool = kmalloc(sizeof(iucv_param) * PARAM_POOL_SIZE,
iucv_param_pool = kzalloc(sizeof(iucv_param) * PARAM_POOL_SIZE,
GFP_KERNEL|GFP_DMA);
if (!iucv_param_pool) {
printk(KERN_WARNING "%s: Could not allocate param pool\n",
......@@ -410,7 +409,6 @@ iucv_init(void)
bus_unregister(&iucv_bus);
return -ENOMEM;
}
memset(iucv_param_pool, 0, sizeof(iucv_param) * PARAM_POOL_SIZE);
/* Initialize irq queue */
INIT_LIST_HEAD(&iucv_irq_queue);
......@@ -793,15 +791,14 @@ iucv_register_program (__u8 pgmname[16],
}
max_connections = iucv_query_maxconn();
iucv_pathid_table = kmalloc(max_connections * sizeof(handler *),
GFP_ATOMIC);
iucv_pathid_table = kcalloc(max_connections, sizeof(handler *),
GFP_ATOMIC);
if (iucv_pathid_table == NULL) {
printk(KERN_WARNING "%s: iucv_pathid_table storage "
"allocation failed\n", __FUNCTION__);
kfree(new_handler);
return NULL;
}
memset (iucv_pathid_table, 0, max_connections * sizeof(handler *));
}
memset(new_handler, 0, sizeof (handler));
memcpy(new_handler->id.user_data, pgmname,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment