If the interrupt didn't have a selected target yet, we could
call cpu_online() and do other cpumask tests with cpu #-1 which
would result in random outcomes.

Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.org>
---
 arch/powerpc/sysdev/xive/common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/sysdev/xive/common.c 
b/arch/powerpc/sysdev/xive/common.c
index 9201819..dbd0f45 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -656,7 +656,8 @@ static int xive_irq_set_affinity(struct irq_data *d,
        /* If existing target is already in the new mask, and is
         * online then do nothing.
         */
-       if (cpu_online(xd->target) &&
+       if (xd->target != XIVE_INVALID_TARGET &&
+           cpu_online(xd->target) &&
            cpumask_test_cpu(xd->target, cpumask))
                return IRQ_SET_MASK_OK;
 
-- 
2.9.3

Reply via email to