diff options
author | Duncan Sands <baldrick@free.fr> | 2006-01-13 03:38:22 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-31 20:23:39 -0500 |
commit | 9a734efec36c991a74610c6c81d28d4222e1c02b (patch) | |
tree | 22af3801a3dc494085cd9e3218876320121a9986 /drivers | |
parent | 0dfcd3e4444e88285ee7c199d0cbda21551d8c5d (diff) |
[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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/atm/cxacru.c | 4 | ||||
-rw-r--r-- | drivers/usb/atm/speedtch.c | 4 | ||||
-rw-r--r-- | drivers/usb/atm/usbatm.c | 8 |
3 files changed, 5 insertions, 11 deletions
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index 0b02a6d9f243..675fdbd5967e 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
@@ -673,14 +673,12 @@ static int cxacru_bind(struct usbatm_data *usbatm_instance, | |||
673 | int ret; | 673 | int ret; |
674 | 674 | ||
675 | /* instance init */ | 675 | /* instance init */ |
676 | instance = kmalloc(sizeof(*instance), GFP_KERNEL); | 676 | instance = kzalloc(sizeof(*instance), GFP_KERNEL); |
677 | if (!instance) { | 677 | if (!instance) { |
678 | dbg("cxacru_bind: no memory for instance data"); | 678 | dbg("cxacru_bind: no memory for instance data"); |
679 | return -ENOMEM; | 679 | return -ENOMEM; |
680 | } | 680 | } |
681 | 681 | ||
682 | memset(instance, 0, sizeof(*instance)); | ||
683 | |||
684 | instance->usbatm = usbatm_instance; | 682 | instance->usbatm = usbatm_instance; |
685 | instance->modem_type = (struct cxacru_modem_type *) id->driver_info; | 683 | instance->modem_type = (struct cxacru_modem_type *) id->driver_info; |
686 | 684 | ||
diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 1aca0b08f192..43ec758b92b5 100644 --- a/drivers/usb/atm/speedtch.c +++ b/drivers/usb/atm/speedtch.c | |||
@@ -715,7 +715,7 @@ static int speedtch_bind(struct usbatm_data *usbatm, | |||
715 | } | 715 | } |
716 | } | 716 | } |
717 | 717 | ||
718 | instance = kmalloc(sizeof(*instance), GFP_KERNEL); | 718 | instance = kzalloc(sizeof(*instance), GFP_KERNEL); |
719 | 719 | ||
720 | if (!instance) { | 720 | if (!instance) { |
721 | usb_err(usbatm, "%s: no memory for instance data!\n", __func__); | 721 | usb_err(usbatm, "%s: no memory for instance data!\n", __func__); |
@@ -723,8 +723,6 @@ static int speedtch_bind(struct usbatm_data *usbatm, | |||
723 | goto fail_release; | 723 | goto fail_release; |
724 | } | 724 | } |
725 | 725 | ||
726 | memset(instance, 0, sizeof(struct speedtch_instance_data)); | ||
727 | |||
728 | instance->usbatm = usbatm; | 726 | instance->usbatm = usbatm; |
729 | 727 | ||
730 | INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance); | 728 | INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance); |
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c index 2eb8552dac12..3ed5f02c36d3 100644 --- a/drivers/usb/atm/usbatm.c +++ b/drivers/usb/atm/usbatm.c | |||
@@ -763,13 +763,12 @@ static int usbatm_atm_open(struct atm_vcc *vcc) | |||
763 | goto fail; | 763 | goto fail; |
764 | } | 764 | } |
765 | 765 | ||
766 | if (!(new = kmalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) { | 766 | if (!(new = kzalloc(sizeof(struct usbatm_vcc_data), GFP_KERNEL))) { |
767 | atm_err(instance, "%s: no memory for vcc_data!\n", __func__); | 767 | atm_err(instance, "%s: no memory for vcc_data!\n", __func__); |
768 | ret = -ENOMEM; | 768 | ret = -ENOMEM; |
769 | goto fail; | 769 | goto fail; |
770 | } | 770 | } |
771 | 771 | ||
772 | memset(new, 0, sizeof(struct usbatm_vcc_data)); | ||
773 | new->vcc = vcc; | 772 | new->vcc = vcc; |
774 | new->vpi = vpi; | 773 | new->vpi = vpi; |
775 | new->vci = vci; | 774 | new->vci = vci; |
@@ -1066,13 +1065,12 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id, | |||
1066 | 1065 | ||
1067 | instance->urbs[i] = urb; | 1066 | instance->urbs[i] = urb; |
1068 | 1067 | ||
1069 | buffer = kmalloc(channel->buf_size, GFP_KERNEL); | 1068 | /* zero the tx padding to avoid leaking information */ |
1069 | buffer = kzalloc(channel->buf_size, GFP_KERNEL); | ||
1070 | if (!buffer) { | 1070 | if (!buffer) { |
1071 | dev_err(dev, "%s: no memory for buffer %d!\n", __func__, i); | 1071 | dev_err(dev, "%s: no memory for buffer %d!\n", __func__, i); |
1072 | goto fail_unbind; | 1072 | goto fail_unbind; |
1073 | } | 1073 | } |
1074 | /* zero the tx padding to avoid leaking information */ | ||
1075 | memset(buffer, 0, channel->buf_size); | ||
1076 | 1074 | ||
1077 | usb_fill_bulk_urb(urb, instance->usb_dev, channel->endpoint, | 1075 | usb_fill_bulk_urb(urb, instance->usb_dev, channel->endpoint, |
1078 | buffer, channel->buf_size, usbatm_complete, channel); | 1076 | buffer, channel->buf_size, usbatm_complete, channel); |