Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0cc5e2e7c3edd8b45775f50c74738d61b43ac5e8
Commit:     0cc5e2e7c3edd8b45775f50c74738d61b43ac5e8
Parent:     efa66f14e2d1aaad8ad7e1664d768de74ffb665b
Author:     Oliver Neukum <[EMAIL PROTECTED]>
AuthorDate: Wed Jan 30 16:06:03 2008 +0100
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Thu Feb 21 15:38:51 2008 -0800

    USB: fix error handling in trancevibrator
    
    trancevibrator should not pretend success if it returns an error.
    
    Signed-off-by: Oliver Neukum <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/misc/trancevibrator.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/misc/trancevibrator.c 
b/drivers/usb/misc/trancevibrator.c
index 67e2fc2..03368ed 100644
--- a/drivers/usb/misc/trancevibrator.c
+++ b/drivers/usb/misc/trancevibrator.c
@@ -59,13 +59,14 @@ static ssize_t set_speed(struct device *dev, struct 
device_attribute *attr,
 {
        struct usb_interface *intf = to_usb_interface(dev);
        struct trancevibrator *tv = usb_get_intfdata(intf);
-       int temp, retval;
+       int temp, retval, old;
 
        temp = simple_strtoul(buf, NULL, 10);
        if (temp > 255)
                temp = 255;
        else if (temp < 0)
                temp = 0;
+       old = tv->speed;
        tv->speed = temp;
 
        dev_dbg(&tv->udev->dev, "speed = %d\n", tv->speed);
@@ -77,6 +78,7 @@ static ssize_t set_speed(struct device *dev, struct 
device_attribute *attr,
                                 tv->speed, /* speed value */
                                 0, NULL, 0, USB_CTRL_GET_TIMEOUT);
        if (retval) {
+               tv->speed = old;
                dev_dbg(&tv->udev->dev, "retval = %d\n", retval);
                return retval;
        }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to