aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r--drivers/usb/misc/auerswald.c6
-rw-r--r--drivers/usb/misc/cytherm.c3
-rw-r--r--drivers/usb/misc/idmouse.c28
-rw-r--r--drivers/usb/misc/ldusb.c14
-rw-r--r--drivers/usb/misc/legousbtower.c11
-rw-r--r--drivers/usb/misc/phidgetkit.c9
-rw-r--r--drivers/usb/misc/phidgetservo.c3
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c5
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.h8
-rw-r--r--drivers/usb/misc/usblcd.c3
-rw-r--r--drivers/usb/misc/usbled.c3
-rw-r--r--drivers/usb/misc/usbtest.c9
12 files changed, 41 insertions, 61 deletions
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
index ad2f4cccd388..1fef36e71c57 100644
--- a/drivers/usb/misc/auerswald.c
+++ b/drivers/usb/misc/auerswald.c
@@ -570,10 +570,9 @@ static int auerchain_setup (pauerchain_t acp, unsigned int numElements)
570 570
571 /* fill the list of free elements */ 571 /* fill the list of free elements */
572 for (;numElements; numElements--) { 572 for (;numElements; numElements--) {
573 acep = (pauerchainelement_t) kmalloc (sizeof (auerchainelement_t), GFP_KERNEL); 573 acep = kzalloc(sizeof(auerchainelement_t), GFP_KERNEL);
574 if (!acep) 574 if (!acep)
575 goto ac_fail; 575 goto ac_fail;
576 memset (acep, 0, sizeof (auerchainelement_t));
577 INIT_LIST_HEAD (&acep->list); 576 INIT_LIST_HEAD (&acep->list);
578 list_add_tail (&acep->list, &acp->free_list); 577 list_add_tail (&acep->list, &acp->free_list);
579 } 578 }
@@ -761,10 +760,9 @@ static int auerbuf_setup (pauerbufctl_t bcp, unsigned int numElements, unsigned
761 760
762 /* fill the list of free elements */ 761 /* fill the list of free elements */
763 for (;numElements; numElements--) { 762 for (;numElements; numElements--) {
764 bep = (pauerbuf_t) kmalloc (sizeof (auerbuf_t), GFP_KERNEL); 763 bep = kzalloc(sizeof(auerbuf_t), GFP_KERNEL);
765 if (!bep) 764 if (!bep)
766 goto bl_fail; 765 goto bl_fail;
767 memset (bep, 0, sizeof (auerbuf_t));
768 bep->list = bcp; 766 bep->list = bcp;
769 INIT_LIST_HEAD (&bep->buff_list); 767 INIT_LIST_HEAD (&bep->buff_list);
770 bep->bufp = kmalloc (bufsize, GFP_KERNEL); 768 bep->bufp = kmalloc (bufsize, GFP_KERNEL);
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
index 6671317b495f..a04204292aa3 100644
--- a/drivers/usb/misc/cytherm.c
+++ b/drivers/usb/misc/cytherm.c
@@ -351,12 +351,11 @@ static int cytherm_probe(struct usb_interface *interface,
351 struct usb_cytherm *dev = NULL; 351 struct usb_cytherm *dev = NULL;
352 int retval = -ENOMEM; 352 int retval = -ENOMEM;
353 353
354 dev = kmalloc (sizeof(struct usb_cytherm), GFP_KERNEL); 354 dev = kzalloc (sizeof(struct usb_cytherm), GFP_KERNEL);
355 if (dev == NULL) { 355 if (dev == NULL) {
356 dev_err (&interface->dev, "Out of memory\n"); 356 dev_err (&interface->dev, "Out of memory\n");
357 goto error; 357 goto error;
358 } 358 }
359 memset (dev, 0x00, sizeof (*dev));
360 359
361 dev->udev = usb_get_dev(udev); 360 dev->udev = usb_get_dev(udev);
362 361
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index d8cde1017985..d0b167256699 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -25,6 +25,7 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/smp_lock.h> 26#include <linux/smp_lock.h>
27#include <linux/completion.h> 27#include <linux/completion.h>
28#include <linux/mutex.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <linux/usb.h> 30#include <linux/usb.h>
30 31
@@ -121,7 +122,7 @@ static struct usb_driver idmouse_driver = {
121}; 122};
122 123
123/* prevent races between open() and disconnect() */ 124/* prevent races between open() and disconnect() */
124static DECLARE_MUTEX(disconnect_sem); 125static DEFINE_MUTEX(disconnect_mutex);
125 126
126static int idmouse_create_image(struct usb_idmouse *dev) 127static int idmouse_create_image(struct usb_idmouse *dev)
127{ 128{
@@ -213,18 +214,18 @@ static int idmouse_open(struct inode *inode, struct file *file)
213 int result = 0; 214 int result = 0;
214 215
215 /* prevent disconnects */ 216 /* prevent disconnects */
216 down(&disconnect_sem); 217 mutex_lock(&disconnect_mutex);
217 218
218 /* get the interface from minor number and driver information */ 219 /* get the interface from minor number and driver information */
219 interface = usb_find_interface (&idmouse_driver, iminor (inode)); 220 interface = usb_find_interface (&idmouse_driver, iminor (inode));
220 if (!interface) { 221 if (!interface) {
221 up(&disconnect_sem); 222 mutex_unlock(&disconnect_mutex);
222 return -ENODEV; 223 return -ENODEV;
223 } 224 }
224 /* get the device information block from the interface */ 225 /* get the device information block from the interface */
225 dev = usb_get_intfdata(interface); 226 dev = usb_get_intfdata(interface);
226 if (!dev) { 227 if (!dev) {
227 up(&disconnect_sem); 228 mutex_unlock(&disconnect_mutex);
228 return -ENODEV; 229 return -ENODEV;
229 } 230 }
230 231
@@ -258,7 +259,7 @@ error:
258 up(&dev->sem); 259 up(&dev->sem);
259 260
260 /* unlock the disconnect semaphore */ 261 /* unlock the disconnect semaphore */
261 up(&disconnect_sem); 262 mutex_unlock(&disconnect_mutex);
262 return result; 263 return result;
263} 264}
264 265
@@ -267,12 +268,12 @@ static int idmouse_release(struct inode *inode, struct file *file)
267 struct usb_idmouse *dev; 268 struct usb_idmouse *dev;
268 269
269 /* prevent a race condition with open() */ 270 /* prevent a race condition with open() */
270 down(&disconnect_sem); 271 mutex_lock(&disconnect_mutex);
271 272
272 dev = (struct usb_idmouse *) file->private_data; 273 dev = (struct usb_idmouse *) file->private_data;
273 274
274 if (dev == NULL) { 275 if (dev == NULL) {
275 up(&disconnect_sem); 276 mutex_unlock(&disconnect_mutex);
276 return -ENODEV; 277 return -ENODEV;
277 } 278 }
278 279
@@ -282,7 +283,7 @@ static int idmouse_release(struct inode *inode, struct file *file)
282 /* are we really open? */ 283 /* are we really open? */
283 if (dev->open <= 0) { 284 if (dev->open <= 0) {
284 up(&dev->sem); 285 up(&dev->sem);
285 up(&disconnect_sem); 286 mutex_unlock(&disconnect_mutex);
286 return -ENODEV; 287 return -ENODEV;
287 } 288 }
288 289
@@ -292,12 +293,12 @@ static int idmouse_release(struct inode *inode, struct file *file)
292 /* the device was unplugged before the file was released */ 293 /* the device was unplugged before the file was released */
293 up(&dev->sem); 294 up(&dev->sem);
294 idmouse_delete(dev); 295 idmouse_delete(dev);
295 up(&disconnect_sem); 296 mutex_unlock(&disconnect_mutex);
296 return 0; 297 return 0;
297 } 298 }
298 299
299 up(&dev->sem); 300 up(&dev->sem);
300 up(&disconnect_sem); 301 mutex_unlock(&disconnect_mutex);
301 return 0; 302 return 0;
302} 303}
303 304
@@ -340,10 +341,9 @@ static int idmouse_probe(struct usb_interface *interface,
340 return -ENODEV; 341 return -ENODEV;
341 342
342 /* allocate memory for our device state and initialize it */ 343 /* allocate memory for our device state and initialize it */
343 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 344 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
344 if (dev == NULL) 345 if (dev == NULL)
345 return -ENOMEM; 346 return -ENOMEM;
346 memset(dev, 0x00, sizeof(*dev));
347 347
348 init_MUTEX(&dev->sem); 348 init_MUTEX(&dev->sem);
349 dev->udev = udev; 349 dev->udev = udev;
@@ -400,7 +400,7 @@ static void idmouse_disconnect(struct usb_interface *interface)
400 struct usb_idmouse *dev; 400 struct usb_idmouse *dev;
401 401
402 /* prevent races with open() */ 402 /* prevent races with open() */
403 down(&disconnect_sem); 403 mutex_lock(&disconnect_mutex);
404 404
405 /* get device structure */ 405 /* get device structure */
406 dev = usb_get_intfdata(interface); 406 dev = usb_get_intfdata(interface);
@@ -422,7 +422,7 @@ static void idmouse_disconnect(struct usb_interface *interface)
422 if (!dev->open) 422 if (!dev->open)
423 idmouse_delete(dev); 423 idmouse_delete(dev);
424 424
425 up(&disconnect_sem); 425 mutex_unlock(&disconnect_mutex);
426 426
427 info("%s disconnected", DRIVER_DESC); 427 info("%s disconnected", DRIVER_DESC);
428} 428}
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c
index e2d1198623eb..966acb474f67 100644
--- a/drivers/usb/misc/ldusb.c
+++ b/drivers/usb/misc/ldusb.c
@@ -33,6 +33,7 @@
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/mutex.h>
36 37
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
38#include <linux/input.h> 39#include <linux/input.h>
@@ -172,7 +173,7 @@ struct ld_usb {
172}; 173};
173 174
174/* prevent races between open() and disconnect() */ 175/* prevent races between open() and disconnect() */
175static DECLARE_MUTEX(disconnect_sem); 176static DEFINE_MUTEX(disconnect_mutex);
176 177
177static struct usb_driver ld_usb_driver; 178static struct usb_driver ld_usb_driver;
178 179
@@ -293,7 +294,7 @@ static int ld_usb_open(struct inode *inode, struct file *file)
293 nonseekable_open(inode, file); 294 nonseekable_open(inode, file);
294 subminor = iminor(inode); 295 subminor = iminor(inode);
295 296
296 down(&disconnect_sem); 297 mutex_lock(&disconnect_mutex);
297 298
298 interface = usb_find_interface(&ld_usb_driver, subminor); 299 interface = usb_find_interface(&ld_usb_driver, subminor);
299 300
@@ -355,7 +356,7 @@ unlock_exit:
355 up(&dev->sem); 356 up(&dev->sem);
356 357
357unlock_disconnect_exit: 358unlock_disconnect_exit:
358 up(&disconnect_sem); 359 mutex_unlock(&disconnect_mutex);
359 360
360 return retval; 361 return retval;
361} 362}
@@ -626,12 +627,11 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id *
626 627
627 /* allocate memory for our device state and intialize it */ 628 /* allocate memory for our device state and intialize it */
628 629
629 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 630 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
630 if (dev == NULL) { 631 if (dev == NULL) {
631 dev_err(&intf->dev, "Out of memory\n"); 632 dev_err(&intf->dev, "Out of memory\n");
632 goto exit; 633 goto exit;
633 } 634 }
634 memset(dev, 0x00, sizeof(*dev));
635 init_MUTEX(&dev->sem); 635 init_MUTEX(&dev->sem);
636 dev->intf = intf; 636 dev->intf = intf;
637 init_waitqueue_head(&dev->read_wait); 637 init_waitqueue_head(&dev->read_wait);
@@ -741,7 +741,7 @@ static void ld_usb_disconnect(struct usb_interface *intf)
741 struct ld_usb *dev; 741 struct ld_usb *dev;
742 int minor; 742 int minor;
743 743
744 down(&disconnect_sem); 744 mutex_lock(&disconnect_mutex);
745 745
746 dev = usb_get_intfdata(intf); 746 dev = usb_get_intfdata(intf);
747 usb_set_intfdata(intf, NULL); 747 usb_set_intfdata(intf, NULL);
@@ -762,7 +762,7 @@ static void ld_usb_disconnect(struct usb_interface *intf)
762 up(&dev->sem); 762 up(&dev->sem);
763 } 763 }
764 764
765 up(&disconnect_sem); 765 mutex_unlock(&disconnect_mutex);
766 766
767 dev_info(&intf->dev, "LD USB Device #%d now disconnected\n", 767 dev_info(&intf->dev, "LD USB Device #%d now disconnected\n",
768 (minor - USB_LD_MINOR_BASE)); 768 (minor - USB_LD_MINOR_BASE));
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 1336745b8f55..779bcf0373ad 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -83,6 +83,7 @@
83#include <linux/module.h> 83#include <linux/module.h>
84#include <linux/smp_lock.h> 84#include <linux/smp_lock.h>
85#include <linux/completion.h> 85#include <linux/completion.h>
86#include <linux/mutex.h>
86#include <asm/uaccess.h> 87#include <asm/uaccess.h>
87#include <linux/usb.h> 88#include <linux/usb.h>
88#include <linux/poll.h> 89#include <linux/poll.h>
@@ -256,7 +257,7 @@ static void tower_disconnect (struct usb_interface *interface);
256 257
257 258
258/* prevent races between open() and disconnect */ 259/* prevent races between open() and disconnect */
259static DECLARE_MUTEX (disconnect_sem); 260static DEFINE_MUTEX (disconnect_mutex);
260 261
261/* file operations needed when we register this driver */ 262/* file operations needed when we register this driver */
262static struct file_operations tower_fops = { 263static struct file_operations tower_fops = {
@@ -349,7 +350,7 @@ static int tower_open (struct inode *inode, struct file *file)
349 nonseekable_open(inode, file); 350 nonseekable_open(inode, file);
350 subminor = iminor(inode); 351 subminor = iminor(inode);
351 352
352 down (&disconnect_sem); 353 mutex_lock (&disconnect_mutex);
353 354
354 interface = usb_find_interface (&tower_driver, subminor); 355 interface = usb_find_interface (&tower_driver, subminor);
355 356
@@ -427,7 +428,7 @@ unlock_exit:
427 up (&dev->sem); 428 up (&dev->sem);
428 429
429unlock_disconnect_exit: 430unlock_disconnect_exit:
430 up (&disconnect_sem); 431 mutex_unlock (&disconnect_mutex);
431 432
432 dbg(2, "%s: leave, return value %d ", __FUNCTION__, retval); 433 dbg(2, "%s: leave, return value %d ", __FUNCTION__, retval);
433 434
@@ -1005,7 +1006,7 @@ static void tower_disconnect (struct usb_interface *interface)
1005 1006
1006 dbg(2, "%s: enter", __FUNCTION__); 1007 dbg(2, "%s: enter", __FUNCTION__);
1007 1008
1008 down (&disconnect_sem); 1009 mutex_lock (&disconnect_mutex);
1009 1010
1010 dev = usb_get_intfdata (interface); 1011 dev = usb_get_intfdata (interface);
1011 usb_set_intfdata (interface, NULL); 1012 usb_set_intfdata (interface, NULL);
@@ -1027,7 +1028,7 @@ static void tower_disconnect (struct usb_interface *interface)
1027 up (&dev->sem); 1028 up (&dev->sem);
1028 } 1029 }
1029 1030
1030 up (&disconnect_sem); 1031 mutex_unlock (&disconnect_mutex);
1031 1032
1032 info("LEGO USB Tower #%d now disconnected", (minor - LEGO_USB_TOWER_MINOR_BASE)); 1033 info("LEGO USB Tower #%d now disconnected", (minor - LEGO_USB_TOWER_MINOR_BASE));
1033 1034
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);
diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c
index b3418d2bcc69..5a040c205eed 100644
--- a/drivers/usb/misc/phidgetservo.c
+++ b/drivers/usb/misc/phidgetservo.c
@@ -252,12 +252,11 @@ servo_probe(struct usb_interface *interface, const struct usb_device_id *id)
252 struct usb_device *udev = interface_to_usbdev(interface); 252 struct usb_device *udev = interface_to_usbdev(interface);
253 struct phidget_servo *dev; 253 struct phidget_servo *dev;
254 254
255 dev = kmalloc(sizeof (struct phidget_servo), GFP_KERNEL); 255 dev = kzalloc(sizeof (struct phidget_servo), GFP_KERNEL);
256 if (dev == NULL) { 256 if (dev == NULL) {
257 dev_err(&interface->dev, "%s - out of memory\n", __FUNCTION__); 257 dev_err(&interface->dev, "%s - out of memory\n", __FUNCTION__);
258 return -ENOMEM; 258 return -ENOMEM;
259 } 259 }
260 memset(dev, 0x00, sizeof (*dev));
261 260
262 dev->udev = usb_get_dev(udev); 261 dev->udev = usb_get_dev(udev);
263 dev->type = id->driver_info; 262 dev->type = id->driver_info;
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 3260d595441f..196c8794a73c 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -3188,7 +3188,7 @@ sisusb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
3188 break; 3188 break;
3189 3189
3190 default: 3190 default:
3191 retval = -EINVAL; 3191 retval = -ENOTTY;
3192 break; 3192 break;
3193 } 3193 }
3194 3194
@@ -3251,12 +3251,11 @@ static int sisusb_probe(struct usb_interface *intf,
3251 dev->devnum); 3251 dev->devnum);
3252 3252
3253 /* Allocate memory for our private */ 3253 /* Allocate memory for our private */
3254 if (!(sisusb = kmalloc(sizeof(*sisusb), GFP_KERNEL))) { 3254 if (!(sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL))) {
3255 printk(KERN_ERR 3255 printk(KERN_ERR
3256 "sisusb: Failed to allocate memory for private data\n"); 3256 "sisusb: Failed to allocate memory for private data\n");
3257 return -ENOMEM; 3257 return -ENOMEM;
3258 } 3258 }
3259 memset(sisusb, 0, sizeof(*sisusb));
3260 kref_init(&sisusb->kref); 3259 kref_init(&sisusb->kref);
3261 3260
3262 init_MUTEX(&(sisusb->lock)); 3261 init_MUTEX(&(sisusb->lock));
diff --git a/drivers/usb/misc/sisusbvga/sisusb.h b/drivers/usb/misc/sisusbvga/sisusb.h
index 1d7a77cc7c4a..a716825d1f9b 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.h
+++ b/drivers/usb/misc/sisusbvga/sisusb.h
@@ -37,24 +37,16 @@
37#ifndef _SISUSB_H_ 37#ifndef _SISUSB_H_
38#define _SISUSB_H_ 38#define _SISUSB_H_
39 39
40#include <linux/version.h>
41#ifdef CONFIG_COMPAT 40#ifdef CONFIG_COMPAT
42#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,10)
43#include <linux/ioctl32.h>
44#define SISUSB_OLD_CONFIG_COMPAT
45#else
46#define SISUSB_NEW_CONFIG_COMPAT 41#define SISUSB_NEW_CONFIG_COMPAT
47#endif 42#endif
48#endif
49 43
50/* For older kernels, support for text consoles is by default 44/* For older kernels, support for text consoles is by default
51 * off. To ensable text console support, change the following: 45 * off. To ensable text console support, change the following:
52 */ 46 */
53#if 0 47#if 0
54#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)
55#define CONFIG_USB_SISUSBVGA_CON 48#define CONFIG_USB_SISUSBVGA_CON
56#endif 49#endif
57#endif
58 50
59/* Version Information */ 51/* Version Information */
60 52
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index cc3dae3f34e0..c82c402285a0 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -270,12 +270,11 @@ static int lcd_probe(struct usb_interface *interface, const struct usb_device_id
270 int retval = -ENOMEM; 270 int retval = -ENOMEM;
271 271
272 /* allocate memory for our device state and initialize it */ 272 /* allocate memory for our device state and initialize it */
273 dev = kmalloc(sizeof(*dev), GFP_KERNEL); 273 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
274 if (dev == NULL) { 274 if (dev == NULL) {
275 err("Out of memory"); 275 err("Out of memory");
276 goto error; 276 goto error;
277 } 277 }
278 memset(dev, 0x00, sizeof(*dev));
279 kref_init(&dev->kref); 278 kref_init(&dev->kref);
280 279
281 dev->udev = usb_get_dev(interface_to_usbdev(interface)); 280 dev->udev = usb_get_dev(interface_to_usbdev(interface));
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c
index 877b081a3a6e..f441964132c0 100644
--- a/drivers/usb/misc/usbled.c
+++ b/drivers/usb/misc/usbled.c
@@ -106,12 +106,11 @@ static int led_probe(struct usb_interface *interface, const struct usb_device_id
106 struct usb_led *dev = NULL; 106 struct usb_led *dev = NULL;
107 int retval = -ENOMEM; 107 int retval = -ENOMEM;
108 108
109 dev = kmalloc(sizeof(struct usb_led), GFP_KERNEL); 109 dev = kzalloc(sizeof(struct usb_led), GFP_KERNEL);
110 if (dev == NULL) { 110 if (dev == NULL) {
111 dev_err(&interface->dev, "Out of memory\n"); 111 dev_err(&interface->dev, "Out of memory\n");
112 goto error; 112 goto error;
113 } 113 }
114 memset (dev, 0x00, sizeof (*dev));
115 114
116 dev->udev = usb_get_dev(udev); 115 dev->udev = usb_get_dev(udev);
117 116
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 84fa1728f052..9d59b901841c 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -382,12 +382,11 @@ alloc_sglist (int nents, int max, int vary)
382 for (i = 0; i < nents; i++) { 382 for (i = 0; i < nents; i++) {
383 char *buf; 383 char *buf;
384 384
385 buf = kmalloc (size, SLAB_KERNEL); 385 buf = kzalloc (size, SLAB_KERNEL);
386 if (!buf) { 386 if (!buf) {
387 free_sglist (sg, i); 387 free_sglist (sg, i);
388 return NULL; 388 return NULL;
389 } 389 }
390 memset (buf, 0, size);
391 390
392 /* kmalloc pages are always physically contiguous! */ 391 /* kmalloc pages are always physically contiguous! */
393 sg_init_one(&sg[i], buf, size); 392 sg_init_one(&sg[i], buf, size);
@@ -842,10 +841,9 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
842 * as with bulk/intr sglists, sglen is the queue depth; it also 841 * as with bulk/intr sglists, sglen is the queue depth; it also
843 * controls which subtests run (more tests than sglen) or rerun. 842 * controls which subtests run (more tests than sglen) or rerun.
844 */ 843 */
845 urb = kmalloc (param->sglen * sizeof (struct urb *), SLAB_KERNEL); 844 urb = kcalloc(param->sglen, sizeof(struct urb *), SLAB_KERNEL);
846 if (!urb) 845 if (!urb)
847 return -ENOMEM; 846 return -ENOMEM;
848 memset (urb, 0, param->sglen * sizeof (struct urb *));
849 for (i = 0; i < param->sglen; i++) { 847 for (i = 0; i < param->sglen; i++) {
850 int pipe = usb_rcvctrlpipe (udev, 0); 848 int pipe = usb_rcvctrlpipe (udev, 0);
851 unsigned len; 849 unsigned len;
@@ -1865,10 +1863,9 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
1865 } 1863 }
1866#endif 1864#endif
1867 1865
1868 dev = kmalloc (sizeof *dev, SLAB_KERNEL); 1866 dev = kzalloc(sizeof(*dev), SLAB_KERNEL);
1869 if (!dev) 1867 if (!dev)
1870 return -ENOMEM; 1868 return -ENOMEM;
1871 memset (dev, 0, sizeof *dev);
1872 info = (struct usbtest_info *) id->driver_info; 1869 info = (struct usbtest_info *) id->driver_info;
1873 dev->info = info; 1870 dev->info = info;
1874 init_MUTEX (&dev->sem); 1871 init_MUTEX (&dev->sem);