Skip to content

Commit f0691dc

Browse files
maluka-dmytrobroonie
authored andcommitted
ASoC: da7219: Check for failure reading AAD IRQ events
When handling an AAD interrupt, if IRQ events read failed (for example, due to i2c "Transfer while suspended" failure, i.e. when attempting to read it while DA7219 is suspended, which may happen due to a spurious AAD interrupt), the events array contains garbage uninitialized values. So instead of trying to interprete those values and doing any actions based on them (potentially resulting in misbehavior, e.g. reporting bogus events), refuse to handle the interrupt. Signed-off-by: Dmytro Maluka <dmy@semihalf.com> Link: https://lore.kernel.org/r/20230717193737.161784-3-dmy@semihalf.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 91e2929 commit f0691dc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

sound/soc/codecs/da7219-aad.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,15 @@ static irqreturn_t da7219_aad_irq_thread(int irq, void *data)
361361
struct da7219_priv *da7219 = snd_soc_component_get_drvdata(component);
362362
u8 events[DA7219_AAD_IRQ_REG_MAX];
363363
u8 statusa;
364-
int i, report = 0, mask = 0;
364+
int i, ret, report = 0, mask = 0;
365365

366366
/* Read current IRQ events */
367-
regmap_bulk_read(da7219->regmap, DA7219_ACCDET_IRQ_EVENT_A,
368-
events, DA7219_AAD_IRQ_REG_MAX);
367+
ret = regmap_bulk_read(da7219->regmap, DA7219_ACCDET_IRQ_EVENT_A,
368+
events, DA7219_AAD_IRQ_REG_MAX);
369+
if (ret) {
370+
dev_warn_ratelimited(component->dev, "Failed to read IRQ events: %d\n", ret);
371+
return IRQ_NONE;
372+
}
369373

370374
if (!events[DA7219_AAD_IRQ_REG_A] && !events[DA7219_AAD_IRQ_REG_B])
371375
return IRQ_NONE;

0 commit comments

Comments
 (0)