mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-13 09:20:17 +00:00
[PATCH] USBATM: kzalloc conversion
Convert kmalloc + memset to kzalloc. Signed-off-by: Duncan Sands <baldrick@free.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
0dfcd3e444
commit
9a734efec3
@ -673,14 +673,12 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* instance init */
|
/* instance init */
|
||||||
instance = kmalloc(sizeof(*instance), GFP_KERNEL);
|
instance = kzalloc(sizeof(*instance), GFP_KERNEL);
|
||||||
if (!instance) {
|
if (!instance) {
|
||||||
dbg("cxacru_bind: no memory for instance data");
|
dbg("cxacru_bind: no memory for instance data");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(instance, 0, sizeof(*instance));
|
|
||||||
|
|
||||||
instance->usbatm = usbatm_instance;
|
instance->usbatm = usbatm_instance;
|
||||||
instance->modem_type = (struct cxacru_modem_type *) id->driver_info;
|
instance->modem_type = (struct cxacru_modem_type *) id->driver_info;
|
||||||
|
|
||||||
|
@ -715,7 +715,7 @@ static int speedtch_bind(struct usbatm_data *usbatm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
instance = kmalloc(sizeof(*instance), GFP_KERNEL);
|
instance = kzalloc(sizeof(*instance), GFP_KERNEL);
|
||||||
|
|
||||||
if (!instance) {
|
if (!instance) {
|
||||||
usb_err(usbatm, "%s: no memory for instance data!\n", __func__);
|
usb_err(usbatm, "%s: no memory for instance data!\n", __func__);
|
||||||
@ -723,8 +723,6 @@ static int speedtch_bind(struct usbatm_data *usbatm,
|
|||||||
goto fail_release;
|
goto fail_release;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(instance, 0, sizeof(struct speedtch_instance_data));
|
|
||||||
|
|
||||||
instance->usbatm = usbatm;
|
instance->usbatm = usbatm;
|
||||||
|
|
||||||
INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance);
|
INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance);
|
||||||
|
@ -763,13 +763,12 @@ static int usbatm_atm_open(struct atm_vcc *vcc)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(new = kmalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) {
|
if (!(new = kzalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) {
|
||||||
atm_err(instance, "%s: no memory for vcc_data!\n", __func__);
|
atm_err(instance, "%s: no memory for vcc_data!\n", __func__);
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(new, 0, sizeof(struct usbatm_vcc_data));
|
|
||||||
new->vcc = vcc;
|
new->vcc = vcc;
|
||||||
new->vpi = vpi;
|
new->vpi = vpi;
|
||||||
new->vci = vci;
|
new->vci = vci;
|
||||||
@ -1066,13 +1065,12 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
|
|||||||
|
|
||||||
instance->urbs[i] = urb;
|
instance->urbs[i] = urb;
|
||||||
|
|
||||||
buffer = kmalloc(channel->buf_size, GFP_KERNEL);
|
/* zero the tx padding to avoid leaking information */
|
||||||
|
buffer = kzalloc(channel->buf_size, GFP_KERNEL);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
dev_err(dev, "%s: no memory for buffer %d!\n", __func__, i);
|
dev_err(dev, "%s: no memory for buffer %d!\n", __func__, i);
|
||||||
goto fail_unbind;
|
goto fail_unbind;
|
||||||
}
|
}
|
||||||
/* zero the tx padding to avoid leaking information */
|
|
||||||
memset(buffer, 0, channel->buf_size);
|
|
||||||
|
|
||||||
usb_fill_bulk_urb(urb, instance->usb_dev, channel->endpoint,
|
usb_fill_bulk_urb(urb, instance->usb_dev, channel->endpoint,
|
||||||
buffer, channel->buf_size, usbatm_complete, channel);
|
buffer, channel->buf_size, usbatm_complete, channel);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user