[patch 32/43] USB: usbtmc: fix stupid bug in open()

From: Greg KH
Date: Fri Mar 20 2009 - 19:37:35 EST


2.6.28-stable review patch. If anyone has any objections, please let us know.

------------------

From: Greg Kroah-Hartman <gregkh@xxxxxxx>

commit 5b10916ea0a62920204517e1c4ce14560b4f96ab upstream.

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@xxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/usb/class/usbtmc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -105,12 +105,13 @@ static int usbtmc_open(struct inode *ino
{
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;
}



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/