HID: sony: fix freeze when inserting ghlive ps3/wii dongles
authorPascal Giard <pascal.giard@etsmtl.ca>
Fri, 4 Jun 2021 16:10:23 +0000 (12:10 -0400)
committerJiri Kosina <jkosina@suse.cz>
Tue, 15 Jun 2021 08:53:18 +0000 (10:53 +0200)
commitfb1a79a6b6e1223ddb18f12aa35e36f832da2290
treed9749a201bb21f7ca7418bb88309cf73e72dbefb
parenta3af901c89685acb590b49ce054ea7e3015a770a
HID: sony: fix freeze when inserting ghlive ps3/wii dongles

This commit fixes a freeze on insertion of a Guitar Hero Live PS3/WiiU
USB dongle. Indeed, with the current implementation, inserting one of
those USB dongles will lead to a hard freeze. I apologize for not
catching this earlier, it didn't occur on my old laptop.

While the issue was isolated to memory alloc/free, I could not figure
out why it causes a freeze. So this patch fixes this issue by
simplifying memory allocation and usage.

We remind that for the dongle to work properly, a control URB needs to
be sent periodically. We used to alloc/free the URB each time this URB
needed to be sent.

With this patch, the memory for the URB is allocated on the probe, reused
for as long as the dongle is plugged in, and freed once the dongle is
unplugged.

Signed-off-by: Pascal Giard <pascal.giard@etsmtl.ca>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-sony.c