ASoC: cs35l56: Rework IRQ allocation
authorSimon Trimmer <simont@opensource.cirrus.com>
Fri, 14 Apr 2023 13:37:49 +0000 (14:37 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 17 Apr 2023 11:55:47 +0000 (12:55 +0100)
commit7d72351a4ef6e1e763bccc24d43c44ffbe1a1555
tree6794f4d830ca4a784d0ba94867e80b950599c0e5
parentfc0b096c92918c2ba4d76411ea763fdeb2ef6b0d
ASoC: cs35l56: Rework IRQ allocation

The irq member was being set before calling the init function and then
cs35l56_irq_request() was called only when the init was successful.
However cs35l56_release() calls devm_free_irq() when the irq member is
set and therefore if init() fails then this will cause an attempted free
of an unallocated IRQ.

Instead pass the desired IRQ number to the cs35l56_irq_request()
function and set cs35l56->irq only when it has been successfully
allocated.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/168147949598.26.711670799488943454@mailman-core.alsa-project.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs35l56-i2c.c
sound/soc/codecs/cs35l56-spi.c
sound/soc/codecs/cs35l56.c
sound/soc/codecs/cs35l56.h