Browse Source

cnss_prealloc: replace in_atomic() with proper API

According to kernel comment for in_atomic(), it's
incorrect to use it outside core kernel code.
To follow this rule, replace
(irqs_disabled() || in_atomic()) with (!preemptible())
when getting GFP flags.

Change-Id: I7cdb28a7f12ffd60216c7bc1921a277de6113cb5
CRs-Fixed: 3273779
Yu Wang 2 years ago
parent
commit
a5a88a8d75
1 changed files with 1 additions and 2 deletions
  1. 1 2
      cnss_prealloc/cnss_prealloc.c

+ 1 - 2
cnss_prealloc/cnss_prealloc.c

@@ -195,8 +195,7 @@ void *wcnss_prealloc_get(size_t size)
 	gfp_t gfp_mask = __GFP_ZERO;
 	int i;
 
-	if (in_interrupt() || irqs_disabled() ||
-	    in_atomic() || rcu_preempt_depth())
+	if (in_interrupt() || !preemptible() || rcu_preempt_depth())
 		gfp_mask |= GFP_ATOMIC;
 	else
 		gfp_mask |= GFP_KERNEL;