Skip to content

Commit bc656ec

Browse files
committed
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/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 30cb2f6 commit bc656ec

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/input/keyboard/sunkbd.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,8 @@ static void sunkbd_reinit(struct work_struct *work)
241241

242242
static void sunkbd_enable(struct sunkbd *sunkbd, bool enable)
243243
{
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;
247246

248247
if (!enable) {
249248
wake_up_interruptible(&sunkbd->wait);

0 commit comments

Comments
 (0)