rts5208: Fix a sleep-in-atomic bug in rtsx_exclusive_enter_ss
authorJia-Ju Bai <baijiaju1990@163.com>
Thu, 1 Jun 2017 03:43:35 +0000 (11:43 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Jun 2017 08:52:00 +0000 (17:52 +0900)
The driver may sleep under a spin lock, and the function call path is:
rtsx_exclusive_enter_ss (acquire the lock by spin_lock)
  rtsx_enter_ss
    rtsx_power_off_card
      sd_cleanup_work
        sd_stop_seq_mode
          sd_switch_clock
            sd_ddr_tuning
              sd_ddr_pre_tuning_tx
                sd_change_phase
                  wait_timeout
                    schedule_timeout --> may sleep

To fix it, "wait_timeout" is replaced with mdelay in sd_change_phase.

Signed-off-by: Jia-Ju Bai <baijiaju1990@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rts5208/sd.c

index aa144542e4e3d3dacea46cb8507250d90462987d..c2eb072cbe1df67d23644a9e976866369de486c1 100644 (file)
@@ -1057,7 +1057,7 @@ fail:
 
        rtsx_write_register(chip, SD_DCMPS_CTL, DCMPS_CHANGE, 0);
        rtsx_write_register(chip, SD_VP_CTL, PHASE_CHANGE, 0);
-       wait_timeout(10);
+       mdelay(10);
        sd_reset_dcm(chip, tune_dir);
        return STATUS_FAIL;
 }