mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
rtc: r7301: Fix a possible sleep-in-atomic bug in rtc7301_set_time
The driver may sleep under a spinlock. The function call path is: rtc7301_set_time (acquire the spinlock) usleep_range --> may sleep To fix it, usleep_range is replaced with udelay. This bug is found by my static analysis tool(DSAC) and checked by my code review. Signed-off-by: Jia-Ju Bai <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
This commit is contained in:
parent
cd8c0bb2bd
commit
298c854520
1 changed files with 1 additions and 1 deletions
|
|
@ -235,7 +235,7 @@ static int rtc7301_set_time(struct device *dev, struct rtc_time *tm)
|
|||
spin_lock_irqsave(&priv->lock, flags);
|
||||
|
||||
rtc7301_stop(priv);
|
||||
usleep_range(200, 300);
|
||||
udelay(300);
|
||||
rtc7301_select_bank(priv, 0);
|
||||
rtc7301_write_time(priv, tm, false);
|
||||
rtc7301_start(priv);
|
||||
|
|
|
|||
Loading…
Reference in a new issue