]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
common/softirq: address violation of MISRA C Rule 13.6
authorAlessandro Zucchelli <alessandro.zucchelli@bugseng.com>
Tue, 23 Jul 2024 12:00:27 +0000 (14:00 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 23 Jul 2024 12:00:27 +0000 (14:00 +0200)
In the file common/softirq macro set_bit is called with argument
smp_processor_id.
Once expanded this set_bit's argument is used in sizeof operations
and thus 'smp_processor_id', being a macro that may expand to a
function call with potential side effects, generates a violation.

To address this violation the value of smp_processor_id is therefore
stored in a variable called 'cpu' before passing it to macro set_bit.

No functional change.

Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/common/softirq.c

index bee4a82009c3e9b21e94992c9469eda48e7ed981..60f344e8425e49207343dd927276dd40988d65f8 100644 (file)
@@ -139,7 +139,9 @@ void cpu_raise_softirq_batch_finish(void)
 
 void raise_softirq(unsigned int nr)
 {
-    set_bit(nr, &softirq_pending(smp_processor_id()));
+    unsigned int cpu = smp_processor_id();
+
+    set_bit(nr, &softirq_pending(cpu));
 }
 
 /*