Merge remote-tracking branches 'spi/topic/qup', 'spi/topic/rockchip', 'spi/topic...
[firefly-linux-kernel-4.4.55.git] / drivers / irqchip / irq-gic-v3.c
index 2ab290bec6552328c214037efc0f6eaa5dff715d..fd8850def1b86a3310e376c821c3aaf33153f1cc 100644 (file)
@@ -238,7 +238,9 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
        if (irq < 16)
                return -EINVAL;
 
-       if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
+       /* SPIs have restrictions on the supported types */
+       if (irq >= 32 && type != IRQ_TYPE_LEVEL_HIGH &&
+                        type != IRQ_TYPE_EDGE_RISING)
                return -EINVAL;
 
        if (gic_irq_in_rdist(d)) {
@@ -249,9 +251,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
                rwp_wait = gic_dist_wait_for_rwp;
        }
 
-       gic_configure_irq(irq, type, base, rwp_wait);
-
-       return 0;
+       return gic_configure_irq(irq, type, base, rwp_wait);
 }
 
 static u64 gic_mpidr_to_affinity(u64 mpidr)
@@ -466,7 +466,7 @@ static u16 gic_compute_target_list(int *base_cpu, const struct cpumask *mask,
                tlist |= 1 << (mpidr & 0xf);
 
                cpu = cpumask_next(cpu, mask);
-               if (cpu == nr_cpu_ids)
+               if (cpu >= nr_cpu_ids)
                        goto out;
 
                mpidr = cpu_logical_map(cpu);