linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / usb / misc / usbtest.c
index ccc5e82..84fa172 100644 (file)
@@ -381,27 +381,17 @@ alloc_sglist (int nents, int max, int vary)
 
        for (i = 0; i < nents; i++) {
                char            *buf;
-               unsigned        j;
 
-               buf = kzalloc (size, SLAB_KERNEL);
+               buf = kmalloc (size, SLAB_KERNEL);
                if (!buf) {
                        free_sglist (sg, i);
                        return NULL;
                }
+               memset (buf, 0, size);
 
                /* kmalloc pages are always physically contiguous! */
                sg_init_one(&sg[i], buf, size);
 
-               switch (pattern) {
-               case 0:
-                       /* already zeroed */
-                       break;
-               case 1:
-                       for (j = 0; j < size; j++)
-                               *buf++ = (u8) (j % 63);
-                       break;
-               }
-
                if (vary) {
                        size += vary;
                        size %= max;
@@ -436,8 +426,6 @@ static int perform_sglist (
                usb_sg_wait (req);
                retval = req->status;
 
-               /* FIXME check resulting data pattern */
-
                /* FIXME if endpoint halted, clear halt (and log) */
        }
 
@@ -854,9 +842,10 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
         * as with bulk/intr sglists, sglen is the queue depth; it also
         * controls which subtests run (more tests than sglen) or rerun.
         */
-       urb = kcalloc(param->sglen, sizeof(struct urb *), SLAB_KERNEL);
+       urb = kmalloc (param->sglen * sizeof (struct urb *), SLAB_KERNEL);
        if (!urb)
                return -ENOMEM;
+       memset (urb, 0, param->sglen * sizeof (struct urb *));
        for (i = 0; i < param->sglen; i++) {
                int                     pipe = usb_rcvctrlpipe (udev, 0);
                unsigned                len;
@@ -1876,9 +1865,10 @@ usbtest_probe (struct usb_interface *intf, const struct usb_device_id *id)
        }
 #endif
 
-       dev = kzalloc(sizeof(*dev), SLAB_KERNEL);
+       dev = kmalloc (sizeof *dev, SLAB_KERNEL);
        if (!dev)
                return -ENOMEM;
+       memset (dev, 0, sizeof *dev);
        info = (struct usbtest_info *) id->driver_info;
        dev->info = info;
        init_MUTEX (&dev->sem);