return !!(irr & (1U << (vector % 32)));
 }
 
+static inline bool is_vector_pending(unsigned int vector)
+{
+       unsigned int irr;
+
+       irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
+       if (irr  & (1 << (vector % 32)))
+               return true;
+
+       return false;
+}
+
 /*
  * Warm reset vector position:
  */
 
        lockdep_assert_held(&vector_lock);
 
        hlist_for_each_entry_safe(apicd, tmp, &cl->head, clist) {
-               unsigned int irr, vector = apicd->prev_vector;
+               unsigned int vector = apicd->prev_vector;
 
                /*
                 * Paranoia: Check if the vector that needs to be cleaned
                 * fixup_irqs() was just called to scan IRR for set bits and
                 * forward them to new destination CPUs via IPIs.
                 */
-               irr = check_irr ? apic_read(APIC_IRR + (vector / 32 * 0x10)) : 0;
-               if (irr & (1U << (vector % 32))) {
+               if (check_irr && is_vector_pending(vector)) {
                        pr_warn_once("Moved interrupt pending in old target APIC %u\n", apicd->irq);
                        rearm = true;
                        continue;
 
 /* A cpu has been removed from cpu_online_mask.  Reset irq affinities. */
 void fixup_irqs(void)
 {
-       unsigned int irr, vector;
+       unsigned int vector;
        struct irq_desc *desc;
        struct irq_data *data;
        struct irq_chip *chip;
                if (IS_ERR_OR_NULL(__this_cpu_read(vector_irq[vector])))
                        continue;
 
-               irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
-               if (irr  & (1 << (vector % 32))) {
+               if (is_vector_pending(vector)) {
                        desc = __this_cpu_read(vector_irq[vector]);
 
                        raw_spin_lock(&desc->lock);