From 1168df7e1cbfa4b45ba2bfd982ff535df50c273c Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Wed, 4 Nov 2009 00:57:35 +0200 Subject: 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 Signed-off-by: Anssi Hannula Signed-off-by: Jiri Kosina --- drivers/hid/usbhid/hid-pidff.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/hid') 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) usbhid_wait_io(hid); if (pidff->pool[PID_SIMULTANEOUS_MAX].value) { - int sim_effects = pidff->pool[PID_SIMULTANEOUS_MAX].value[0]; - while (sim_effects < 2) { + while (pidff->pool[PID_SIMULTANEOUS_MAX].value[0] < 2) { if (i++ > 20) { printk(KERN_WARNING "hid-pidff: device reports " "%d simultaneous effects\n", - sim_effects); + pidff->pool[PID_SIMULTANEOUS_MAX].value[0]); break; } debug("pid_pool requested again"); -- cgit v1.2.2