Skip to content

Commit

Permalink
USB: usbtmc: fix stupid bug in open()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Greg Kroah-Hartman committed Mar 17, 2009
1 parent ee568b2 commit 5b10916
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/class/usbtmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 5b10916

Please sign in to comment.