Skip to content

Commit 16a5852

Browse files
committed
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. Change-Id: Ib0149c24bfee995968f3e13266d0453d27e8d52e Signed-off-by: Ricardo Rivera-Matos <[email protected]> Signed-off-by: Vlad Karpovich <[email protected]> Acked-by: Ricardo Rivera-Matos <[email protected]> Acked-by: Charles Keepax <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 7f05043 commit 16a5852

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

sound/soc/codecs/cs35l45.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,10 @@ static irqreturn_t cs35l45_spk_safe_err(int irq, void *data)
10231023

10241024
i = irq - regmap_irq_get_virq(cs35l45->irq_data, 0);
10251025

1026-
dev_err(cs35l45->dev, "%s condition detected!\n", cs35l45_irqs[i].name);
1026+
if (i < 0 || i >= ARRAY_SIZE(cs35l45_irqs))
1027+
dev_err(cs35l45->dev, "Unspecified global error condition (%d) detected!\n", irq);
1028+
else
1029+
dev_err(cs35l45->dev, "%s condition detected!\n", cs35l45_irqs[i].name);
10271030

10281031
return IRQ_HANDLED;
10291032
}

0 commit comments

Comments
 (0)