ASoC: cs35l45: Checks index of cs35l45_irqs[]

Checks the index computed by the virq offset before printing the
error condition in cs35l45_spk_safe_err() handler.

Signed-off-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
Signed-off-by: Vlad Karpovich <vkarpovi@opensource.cirrus.com>
Acked-by: Ricardo Rivera-Matos <rriveram@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230831162042.471801-1-vkarpovi@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Ricardo Rivera-Matos 2023-08-31 11:20:39 -05:00 committed by Mark Brown
parent ad19199233
commit 44f37b6ce0
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -1023,7 +1023,10 @@ static irqreturn_t cs35l45_spk_safe_err(int irq, void *data)
i = irq - regmap_irq_get_virq(cs35l45->irq_data, 0);
dev_err(cs35l45->dev, "%s condition detected!\n", cs35l45_irqs[i].name);
if (i < 0 || i >= ARRAY_SIZE(cs35l45_irqs))
dev_err(cs35l45->dev, "Unspecified global error condition (%d) detected!\n", irq);
else
dev_err(cs35l45->dev, "%s condition detected!\n", cs35l45_irqs[i].name);
return IRQ_HANDLED;
}