diff options
author | Anssi Hannula <anssi.hannula@iki.fi> | 2009-11-03 17:57:35 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2009-11-04 04:04:08 -0500 |
commit | 1168df7e1cbfa4b45ba2bfd982ff535df50c273c (patch) | |
tree | c619c65b41b5422f001f55b59e8bb183fd71b493 /drivers/hid/usbhid/hid-pidff.c | |
parent | 80f506918fdaaca6b574ba931536a58ce015c7be (diff) |
HID: pidff - fix unnecessary loop iterations on reset
When encountering a strange value in the pool report, pidff_reset
will always refetch the report 20 times, even if one of the retries
results in a sane value. This is because a temporary variable being
used to store the value is not being updated inside the loop.
Fix it by using the value directly in the loop.
Reported-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid/hid-pidff.c')
-rw-r--r-- | drivers/hid/usbhid/hid-pidff.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index 484e3eec2f88..e565dbe91d97 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c | |||
@@ -1181,12 +1181,11 @@ static void pidff_reset(struct pidff_device *pidff) | |||
1181 | usbhid_wait_io(hid); | 1181 | usbhid_wait_io(hid); |
1182 | 1182 | ||
1183 | if (pidff->pool[PID_SIMULTANEOUS_MAX].value) { | 1183 | if (pidff->pool[PID_SIMULTANEOUS_MAX].value) { |
1184 | int sim_effects = pidff->pool[PID_SIMULTANEOUS_MAX].value[0]; | 1184 | while (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] < 2) { |
1185 | while (sim_effects < 2) { | ||
1186 | if (i++ > 20) { | 1185 | if (i++ > 20) { |
1187 | printk(KERN_WARNING "hid-pidff: device reports " | 1186 | printk(KERN_WARNING "hid-pidff: device reports " |
1188 | "%d simultaneous effects\n", | 1187 | "%d simultaneous effects\n", |
1189 | sim_effects); | 1188 | pidff->pool[PID_SIMULTANEOUS_MAX].value[0]); |
1190 | break; | 1189 | break; |
1191 | } | 1190 | } |
1192 | debug("pid_pool requested again"); | 1191 | debug("pid_pool requested again"); |