Commit 95b866d5afcafee00fc9ad70665e48c86d8c4e0f

Authored by Linus Torvalds
1 parent b5ff7df3df

e1000e: Fix incorrect debug warning

Doing 'WARN_ON(preempt_count())' was horribly horribly wrong, and would
cause tons of warnings at bootup if PREEMPT was enabled because the
initcalls currently run with the kernel lock, which increments the
preempt count.

At the same time, the warning was also insufficient, since it didn't
check that interrupts were enabled.

The proper debug function to use for something that can sleep and wants
a warning if it's called in the wrong context is 'might_sleep()'.

Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

drivers/net/e1000e/ich8lan.c
... ... @@ -396,7 +396,7 @@
396 396 u32 extcnf_ctrl;
397 397 u32 timeout = PHY_CFG_TIMEOUT;
398 398  
399   - WARN_ON(preempt_count());
  399 + might_sleep();
400 400  
401 401 if (!mutex_trylock(&nvm_mutex)) {
402 402 WARN(1, KERN_ERR "e1000e mutex contention. Owned by pid %d\n",