[PATCH] USB: kzalloc in sisusbvga
authorOliver Neukum <oliver@neukum.org>
Fri, 6 Jan 2006 22:27:17 +0000 (23:27 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Mar 2006 22:49:54 +0000 (14:49 -0800)
this does two things:
- use kzalloc where appropriate
- correct error return codes in ioctl

Signed-off-by: Oliver Neukum <oliver@neukum.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/misc/sisusbvga/sisusb.c

index 3260d595441f5837323539b8add11ac5c997e28b..196c8794a73cf161d3262059d648fe397125d64d 100644 (file)
@@ -3188,7 +3188,7 @@ sisusb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                        break;
 
                default:
-                       retval = -EINVAL;
+                       retval = -ENOTTY;
                        break;
        }
 
@@ -3251,12 +3251,11 @@ static int sisusb_probe(struct usb_interface *intf,
                dev->devnum);
 
        /* Allocate memory for our private */
-       if (!(sisusb = kmalloc(sizeof(*sisusb), GFP_KERNEL))) {
+       if (!(sisusb = kzalloc(sizeof(*sisusb), GFP_KERNEL))) {
                printk(KERN_ERR
                        "sisusb: Failed to allocate memory for private data\n");
                return -ENOMEM;
        }
-       memset(sisusb, 0, sizeof(*sisusb));
        kref_init(&sisusb->kref);
 
        init_MUTEX(&(sisusb->lock));