[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86: Address MISRA Rule 13.6
commit e9b0f8b6909dcba9843250c486e80879b042fd65 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Tue Apr 2 16:26:22 2024 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Fri Apr 5 14:54:53 2024 +0100 x86: Address MISRA Rule 13.6 MISRA Rule 13.6 doesn't like having an expression in a sizeof() which potentially has side effects, including function calls. Address several violations by pulling the expression out into a local variable. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/irq.c | 4 ++-- xen/arch/x86/time.c | 6 ++++-- xen/drivers/passthrough/amd/iommu_intr.c | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 0487f734a5..a042faf104 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -1149,9 +1149,9 @@ static void cf_check irq_guest_eoi_timer_fn(void *data) for ( i = 0; i < action->nr_guests; i++ ) { struct domain *d = action->guest[i]; - unsigned int pirq = domain_irq_to_pirq(d, irq); + struct pirq *pirq = pirq_info(d, domain_irq_to_pirq(d, irq)); - if ( test_and_clear_bool(pirq_info(d, pirq)->masked) ) + if ( test_and_clear_bool(pirq->masked) ) action->in_flight--; } diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 6087004789..6f136f4b14 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -2503,7 +2503,9 @@ static long cmos_utc_offset; /* in seconds */ int time_suspend(void) { - if ( smp_processor_id() == 0 ) + unsigned int cpu = smp_processor_id(); + + if ( cpu == 0 ) { cmos_utc_offset = -get_wallclock_time(); cmos_utc_offset += get_sec(); @@ -2514,7 +2516,7 @@ int time_suspend(void) } /* Better to cancel calibration timer for accuracy. */ - clear_bit(TIME_CALIBRATE_SOFTIRQ, &softirq_pending(smp_processor_id())); + clear_bit(TIME_CALIBRATE_SOFTIRQ, &softirq_pending(cpu)); return 0; } diff --git a/xen/drivers/passthrough/amd/iommu_intr.c b/xen/drivers/passthrough/amd/iommu_intr.c index d9eefcd8e4..7fc796dec2 100644 --- a/xen/drivers/passthrough/amd/iommu_intr.c +++ b/xen/drivers/passthrough/amd/iommu_intr.c @@ -183,6 +183,7 @@ static void free_intremap_entry(const struct amd_iommu *iommu, unsigned int bdf, unsigned int index) { union irte_ptr entry = get_intremap_entry(iommu, bdf, index); + struct ivrs_mappings *ivrs = get_ivrs_mappings(iommu->seg); if ( iommu->ctrl.ga_en ) { @@ -201,7 +202,7 @@ static void free_intremap_entry(const struct amd_iommu *iommu, else ACCESS_ONCE(entry.ptr32->raw) = 0; - __clear_bit(index, get_ivrs_mappings(iommu->seg)[bdf].intremap_inuse); + __clear_bit(index, ivrs[bdf].intremap_inuse); } static void update_intremap_entry(const struct amd_iommu *iommu, -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |