diff options
Diffstat (limited to 'drivers/usb/misc/trancevibrator.c')
-rw-r--r-- | 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 67e2fc20eeeb..03368edf3f22 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, | |||
59 | { | 59 | { |
60 | struct usb_interface *intf = to_usb_interface(dev); | 60 | struct usb_interface *intf = to_usb_interface(dev); |
61 | struct trancevibrator *tv = usb_get_intfdata(intf); | 61 | struct trancevibrator *tv = usb_get_intfdata(intf); |
62 | int temp, retval; | 62 | int temp, retval, old; |
63 | 63 | ||
64 | temp = simple_strtoul(buf, NULL, 10); | 64 | temp = simple_strtoul(buf, NULL, 10); |
65 | if (temp > 255) | 65 | if (temp > 255) |
66 | temp = 255; | 66 | temp = 255; |
67 | else if (temp < 0) | 67 | else if (temp < 0) |
68 | temp = 0; | 68 | temp = 0; |
69 | old = tv->speed; | ||
69 | tv->speed = temp; | 70 | tv->speed = temp; |
70 | 71 | ||
71 | dev_dbg(&tv->udev->dev, "speed = %d\n", tv->speed); | 72 | 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, | |||
77 | tv->speed, /* speed value */ | 78 | tv->speed, /* speed value */ |
78 | 0, NULL, 0, USB_CTRL_GET_TIMEOUT); | 79 | 0, NULL, 0, USB_CTRL_GET_TIMEOUT); |
79 | if (retval) { | 80 | if (retval) { |
81 | tv->speed = old; | ||
80 | dev_dbg(&tv->udev->dev, "retval = %d\n", retval); | 82 | dev_dbg(&tv->udev->dev, "retval = %d\n", retval); |
81 | return retval; | 83 | return retval; |
82 | } | 84 | } |