hwmon: (corsair-cpro) Use a separate buffer for sending commands
authorAleksa Savic <savicaleksa83@gmail.com>
Sat, 4 May 2024 09:25:01 +0000 (11:25 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Sat, 4 May 2024 13:36:41 +0000 (06:36 -0700)
commite0cd85dc666cb08e1bd313d560cb4eff4d04219e
treea04317e2488f5e18ecc58bdd9b1e7f9271ee7f4e
parente67572cd2204894179d89bd7b984072f19313b03
hwmon: (corsair-cpro) Use a separate buffer for sending commands

Introduce cmd_buffer, a separate buffer for storing only
the command that is sent to the device. Before this separation,
the existing buffer was shared for both the command and the
report received in ccp_raw_event(), which was copied into it.

However, because of hidraw, the raw event parsing may be triggered
in the middle of sending a command, resulting in outputting gibberish
to the device. Using a separate buffer resolves this.

Fixes: 40c3a4454225 ("hwmon: add Corsair Commander Pro driver")
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
Acked-by: Marius Zachmann <mail@mariuszachmann.de>
Link: https://lore.kernel.org/r/20240504092504.24158-2-savicaleksa83@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/corsair-cpro.c