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

Configure Feed

Select the types of activity you want to include in your feed.

Input: ibm-panel - 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.

Reviewed-by: Eddie James <eajames@linux.ibm.com>
Reviewed-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20240904044735.1047285-1-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+1 -4
+1 -4
drivers/input/misc/ibm-panel.c
··· 77 77 static int ibm_panel_i2c_slave_cb(struct i2c_client *client, 78 78 enum i2c_slave_event event, u8 *val) 79 79 { 80 - unsigned long flags; 81 80 struct ibm_panel *panel = i2c_get_clientdata(client); 82 81 83 82 dev_dbg(&panel->input->dev, "event: %u data: %02x\n", event, *val); 84 83 85 - spin_lock_irqsave(&panel->lock, flags); 84 + guard(spinlock_irqsave)(&panel->lock); 86 85 87 86 switch (event) { 88 87 case I2C_SLAVE_STOP: ··· 112 113 default: 113 114 break; 114 115 } 115 - 116 - spin_unlock_irqrestore(&panel->lock, flags); 117 116 118 117 return 0; 119 118 }