diff options
author | Oliver Neukum <oliver@neukum.org> | 2006-01-06 16:41:51 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-20 17:49:53 -0500 |
commit | 17590840dc3c14cb059817466884ac9bd97c4a35 (patch) | |
tree | 9ff51010413c6118de85bac332fd1ff54458ba36 /drivers/usb/misc | |
parent | 1144cf7af2ff8e6816e360d03f867439f7efde40 (diff) |
[PATCH] USB: kzalloc in PhidgetInterfaceKit
another for kzalloc.
Signed-off-by: Oliver Neukum <oliver@neukum.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r-- | drivers/usb/misc/phidgetkit.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c index 605a3c87e05c..997db5d8e35b 100644 --- a/drivers/usb/misc/phidgetkit.c +++ b/drivers/usb/misc/phidgetkit.c | |||
@@ -88,7 +88,7 @@ static int change_outputs(struct phidget_interfacekit *kit, int output_num, int | |||
88 | int retval; | 88 | int retval; |
89 | int n; | 89 | int n; |
90 | 90 | ||
91 | buffer = kmalloc(4, GFP_KERNEL); | 91 | buffer = kzalloc(4, GFP_KERNEL); |
92 | if (!buffer) { | 92 | if (!buffer) { |
93 | dev_err(&kit->udev->dev, "%s - out of memory\n", | 93 | dev_err(&kit->udev->dev, "%s - out of memory\n", |
94 | __FUNCTION__); | 94 | __FUNCTION__); |
@@ -96,7 +96,6 @@ static int change_outputs(struct phidget_interfacekit *kit, int output_num, int | |||
96 | } | 96 | } |
97 | 97 | ||
98 | kit->outputs[output_num] = enable; | 98 | kit->outputs[output_num] = enable; |
99 | memset(buffer, 0, 4); | ||
100 | for (n=0; n<8; n++) { | 99 | for (n=0; n<8; n++) { |
101 | if (kit->outputs[n]) { | 100 | if (kit->outputs[n]) { |
102 | buffer[0] |= 1 << n; | 101 | buffer[0] |= 1 << n; |
@@ -192,7 +191,7 @@ static ssize_t set_backlight(struct device *dev, struct device_attribute *attr, | |||
192 | unsigned char *buffer; | 191 | unsigned char *buffer; |
193 | int retval = -ENOMEM; | 192 | int retval = -ENOMEM; |
194 | 193 | ||
195 | buffer = kmalloc(8, GFP_KERNEL); | 194 | buffer = kzalloc(8, GFP_KERNEL); |
196 | if (!buffer) { | 195 | if (!buffer) { |
197 | dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__); | 196 | dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__); |
198 | goto exit; | 197 | goto exit; |
@@ -202,7 +201,6 @@ static ssize_t set_backlight(struct device *dev, struct device_attribute *attr, | |||
202 | retval = -EINVAL; | 201 | retval = -EINVAL; |
203 | goto exit; | 202 | goto exit; |
204 | } | 203 | } |
205 | memset(buffer, 0x00, 8); | ||
206 | if (enabled) | 204 | if (enabled) |
207 | buffer[0] = 0x01; | 205 | buffer[0] = 0x01; |
208 | buffer[7] = 0x11; | 206 | buffer[7] = 0x11; |
@@ -406,12 +404,11 @@ static int interfacekit_probe(struct usb_interface *intf, const struct usb_devic | |||
406 | pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); | 404 | pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); |
407 | maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe)); | 405 | maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe)); |
408 | 406 | ||
409 | kit = kmalloc(sizeof(*kit), GFP_KERNEL); | 407 | kit = kzalloc(sizeof(*kit), GFP_KERNEL); |
410 | if (kit == NULL) { | 408 | if (kit == NULL) { |
411 | dev_err(&intf->dev, "%s - out of memory\n", __FUNCTION__); | 409 | dev_err(&intf->dev, "%s - out of memory\n", __FUNCTION__); |
412 | return -ENOMEM; | 410 | return -ENOMEM; |
413 | } | 411 | } |
414 | memset(kit, 0, sizeof(*kit)); | ||
415 | kit->ifkit = ifkit; | 412 | kit->ifkit = ifkit; |
416 | 413 | ||
417 | kit->data = usb_buffer_alloc(dev, 8, SLAB_ATOMIC, &kit->data_dma); | 414 | kit->data = usb_buffer_alloc(dev, 8, SLAB_ATOMIC, &kit->data_dma); |