瀏覽代碼

rtc: r7301: Fix a possible sleep-in-atomic bug in rtc7301_read_time

The driver may sleep under a spinlock.
The function call path is:
rtc7301_read_time (acquire the spinlock)
  rtc7301_wait_while_busy
    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 <baijiaju1990@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Jia-Ju Bai 7 年之前
父節點
當前提交
cd8c0bb2bd
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/rtc/rtc-r7301.c

+ 1 - 1
drivers/rtc/rtc-r7301.c

@@ -95,7 +95,7 @@ static int rtc7301_wait_while_busy(struct rtc7301_priv *priv)
 		if (!(val & RTC7301_CONTROL_BUSY))
 			return 0;
 
-		usleep_range(200, 300);
+		udelay(300);
 	}
 
 	return -ETIMEDOUT;