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

Input: sunkbd - 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-8-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+2 -3
+2 -3
drivers/input/keyboard/sunkbd.c
··· 241 241 242 242 static void sunkbd_enable(struct sunkbd *sunkbd, bool enable) 243 243 { 244 - serio_pause_rx(sunkbd->serio); 245 - sunkbd->enabled = enable; 246 - serio_continue_rx(sunkbd->serio); 244 + scoped_guard(serio_pause_rx, sunkbd->serio) 245 + sunkbd->enabled = enable; 247 246 248 247 if (!enable) { 249 248 wake_up_interruptible(&sunkbd->wait);