Skip to content

Commit 229ba71

Browse files
committed
Input: locomokbd - use guard notation when acquiring spinlock
Using guard notation makes the code more compact and error handling more robust by ensuring that locks are released in all code paths when control leaves critical section. Link: https://lore.kernel.org/r/Zxr4AMJrzhZlHAlf@google.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent dda8fdb commit 229ba71

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/input/keyboard/locomokbd.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,10 @@ static inline void locomokbd_reset_col(unsigned long membase, int col)
112112
static void locomokbd_scankeyboard(struct locomokbd *locomokbd)
113113
{
114114
unsigned int row, col, rowd;
115-
unsigned long flags;
116115
unsigned int num_pressed;
117116
unsigned long membase = locomokbd->base;
118117

119-
spin_lock_irqsave(&locomokbd->lock, flags);
118+
guard(spinlock_irqsave)(&locomokbd->lock);
120119

121120
locomokbd_charge_all(membase);
122121

@@ -167,8 +166,6 @@ static void locomokbd_scankeyboard(struct locomokbd *locomokbd)
167166
mod_timer(&locomokbd->timer, jiffies + SCAN_INTERVAL);
168167
else
169168
locomokbd->count_cancel = 0;
170-
171-
spin_unlock_irqrestore(&locomokbd->lock, flags);
172169
}
173170

174171
/*

0 commit comments

Comments
 (0)