diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c
index 9fb2df0d8dfbf334e67b4e48c4a5ef4af7752dc8..c4381d9516f658ff62c6a2fd767310c78d80b7bc 100644
--- a/lib/smp_processor_id.c
+++ b/lib/smp_processor_id.c
@@ -23,7 +23,7 @@ notrace unsigned int debug_smp_processor_id(void)
 	 * Kernel threads bound to a single CPU can safely use
 	 * smp_processor_id():
 	 */
-	cpumask_of_cpu_ptr_next(this_mask, cpu);
+	cpumask_of_cpu_ptr_next(this_mask, this_cpu);
 
 	if (cpus_equal(current->cpus_allowed, *this_mask))
 		goto out;