]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
USB: usbtmc: fix stupid bug in open()
authorGreg Kroah-Hartman <gregkh@suse.de>
Wed, 11 Mar 2009 03:42:55 +0000 (20:42 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 17 Mar 2009 21:01:28 +0000 (14:01 -0700)
open() will never succeed, as we always return -ENODEV.  Fix this
obvious bug.

Thanks to Jouni Ryno for reporting it.

Reported-by: Jouni Ryno <Jouni.Ryno@fmi.fi>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/class/usbtmc.c

index 0f5c05f6f9df0fd022a1eebf5d49d8c2931a6c47..895a0983900121ccd19542670da41ae490aaa9b9 100644 (file)
@@ -106,12 +106,13 @@ static int usbtmc_open(struct inode *inode, struct file *filp)
 {
        struct usb_interface *intf;
        struct usbtmc_device_data *data;
-       int retval = -ENODEV;
+       int retval = 0;
 
        intf = usb_find_interface(&usbtmc_driver, iminor(inode));
        if (!intf) {
                printk(KERN_ERR KBUILD_MODNAME
                       ": can not find device for minor %d", iminor(inode));
+               retval = -ENODEV;
                goto exit;
        }