1 From 498c4b4e9c23855d17ecc2a108d949bb68020481 Mon Sep 17 00:00:00 2001
2 From: Jia-Ju Bai <baijiaju1990@163.com>
3 Date: Mon, 5 Jun 2017 15:30:16 +0800
4 Subject: staging: rt5208: Fix a sleep-in-atomic bug in xd_copy_page
6 From: Jia-Ju Bai <baijiaju1990@163.com>
8 commit 498c4b4e9c23855d17ecc2a108d949bb68020481 upstream.
10 The driver may sleep under a spin lock, and the function call path is:
11 rtsx_exclusive_enter_ss (acquire the lock by spin_lock)
19 schedule_timeout --> may sleep
21 To fix it, "wait_timeout" is replaced with mdelay in xd_copy_page.
23 Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
24 Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
25 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
28 drivers/staging/rts5208/xd.c | 2 +-
29 1 file changed, 1 insertion(+), 1 deletion(-)
31 --- a/drivers/staging/rts5208/xd.c
32 +++ b/drivers/staging/rts5208/xd.c
33 @@ -1252,7 +1252,7 @@ static int xd_copy_page(struct rtsx_chip
35 rtsx_read_register(chip, XD_CTL, ®);
36 if (reg & (XD_ECC1_ERROR | XD_ECC2_ERROR)) {
40 if (detect_card_cd(chip,
41 XD_CARD) != STATUS_SUCCESS) {