Skip to content

Commit dda8fdb

Browse files
committed
Input: hilkbd - 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/Zxr30BpPobpM65vO@google.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent cbdc3f9 commit dda8fdb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/input/keyboard/hilkbd.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,8 @@ static irqreturn_t hil_interrupt(int irq, void *handle)
180180
/* send a command to the HIL */
181181
static void hil_do(unsigned char cmd, unsigned char *data, unsigned int len)
182182
{
183-
unsigned long flags;
183+
guard(spinlock_irqsave)(&hil_dev.lock);
184184

185-
spin_lock_irqsave(&hil_dev.lock, flags);
186185
while (hil_busy())
187186
/* wait */;
188187
hil_command(cmd);
@@ -191,7 +190,6 @@ static void hil_do(unsigned char cmd, unsigned char *data, unsigned int len)
191190
/* wait */;
192191
hil_write_data(*(data++));
193192
}
194-
spin_unlock_irqrestore(&hil_dev.lock, flags);
195193
}
196194

197195

0 commit comments

Comments
 (0)