regmap: Don't try to map non-existant IRQs
Mark Brown [Tue, 5 Jun 2012 13:29:36 +0000 (14:29 +0100)]
If the driver supplied an empty entry in the array of IRQs then return
an error rather than trying to do the mapping. This is intended for use
with handling chip variants and similar situations.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
(cherry picked from commit bfd6185ddecc6e6f6bd654c053c307c9e49ca391)

Change-Id: I4f39385f1eb75af943cff001ba61efa5aa468942
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-on: http://git-master/r/131470
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

drivers/base/regmap/regmap-irq.c

index c190229..8e94e0e 100644 (file)
@@ -346,6 +346,10 @@ EXPORT_SYMBOL_GPL(regmap_irq_chip_get_base);
  */
 int regmap_irq_get_virq(struct regmap_irq_chip_data *data, int irq)
 {
+       /* Handle holes in the IRQ list */
+       if (!data->chip->irqs[irq].mask)
+               return -EINVAL;
+
        return irq_create_mapping(data->domain, irq);
 }
 EXPORT_SYMBOL_GPL(regmap_irq_get_virq);