Skip to content

Commit c91ae81

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

File tree

1 file changed

+4
-4
lines changed
  • drivers/input/touchscreen

1 file changed

+4
-4
lines changed

drivers/input/touchscreen/elo.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ static int elo_command_10(struct elo *elo, unsigned char *packet)
225225

226226
mutex_lock(&elo->cmd_mutex);
227227

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+
}
232232

233233
if (serio_write(elo->serio, ELO10_LEAD_BYTE))
234234
goto out;

0 commit comments

Comments
 (0)