Skip to content

Commit d3046ba

Browse files
lumaggregkh
authored andcommitted
pcmcia: fix a boot time warning in pcmcia cs code
During bootup pcmcia (pccardd) code enforces the following warning backtrace: do not call blocking ops when !TASK_RUNNING; state=1 set at [<c0319e74>] pccardd+0xb8/0x3fc Modules linked in: CPU: 0 PID: 14 Comm: pccardd Not tainted 4.0.0-rc6+ raspberrypi#11 Hardware name: Sharp-Collie [<c0105cd8>] (unwind_backtrace) from [<c0103ef8>] (show_stack+0x10/0x14) [<c0103ef8>] (show_stack) from [<c010e9b8>] (warn_slowpath_common+0x74/0xac) [<c010e9b8>] (warn_slowpath_common) from [<c010ea20>] (warn_slowpath_fmt+0x30/0x40) [<c010ea20>] (warn_slowpath_fmt) from [<c012b1b4>] (__might_sleep+0x84/0xa0) [<c012b1b4>] (__might_sleep) from [<c040fbb0>] (mutex_lock_nested+0x24/0x388) [<c040fbb0>] (mutex_lock_nested) from [<c0319eb4>] (pccardd+0xf8/0x3fc) [<c0319eb4>] (pccardd) from [<c0127370>] (kthread+0xdc/0xfc) [<c0127370>] (kthread) from [<c01013a8>] (ret_from_fork+0x14/0x2c) ---[ end trace fd94911637eed4ba ]--- This happens due to kthread trying to lock mutex in a TASK_INTERRUPTIBLE state. Limit TASK_INTERRUPTIBLE task state to the schedule() call only, so that the rest of the code runs in TASK_RUNNING state. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7879b1d commit d3046ba

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎drivers/pcmcia/cs.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,6 @@ static int pccardd(void *__skt)
626626
unsigned int events;
627627
unsigned int sysfs_events;
628628

629-
set_current_state(TASK_INTERRUPTIBLE);
630-
631629
spin_lock_irqsave(&skt->thread_lock, flags);
632630
events = skt->thread_events;
633631
skt->thread_events = 0;
@@ -675,11 +673,15 @@ static int pccardd(void *__skt)
675673
if (kthread_should_stop())
676674
break;
677675

676+
set_current_state(TASK_INTERRUPTIBLE);
677+
678678
schedule();
679+
680+
/* make sure we are running */
681+
__set_current_state(TASK_RUNNING);
682+
679683
try_to_freeze();
680684
}
681-
/* make sure we are running before we exit */
682-
set_current_state(TASK_RUNNING);
683685

684686
/* shut down socket, if a device is still present */
685687
if (skt->state & SOCKET_PRESENT) {

0 commit comments

Comments
 (0)