Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: elo - use guard notation when pausing serio port

Using guard notation makes the code more compact and error handling
more robust by ensuring that serio ports are resumed in all code paths
when control leaves critical section.

Link: https://lore.kernel.org/r/20240905041732.2034348-10-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+4 -4
+4 -4
drivers/input/touchscreen/elo.c
··· 225 225 226 226 mutex_lock(&elo->cmd_mutex); 227 227 228 - serio_pause_rx(elo->serio); 229 - elo->expected_packet = toupper(packet[0]); 230 - init_completion(&elo->cmd_done); 231 - serio_continue_rx(elo->serio); 228 + scoped_guard(serio_pause_rx, elo->serio) { 229 + elo->expected_packet = toupper(packet[0]); 230 + init_completion(&elo->cmd_done); 231 + } 232 232 233 233 if (serio_write(elo->serio, ELO10_LEAD_BYTE)) 234 234 goto out;