summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/cs35l56.c
diff options
context:
space:
mode:
authorSimon Trimmer <simont@opensource.cirrus.com>2023-04-14 16:37:49 +0300
committerMark Brown <broonie@kernel.org>2023-04-17 14:55:47 +0300
commit7d72351a4ef6e1e763bccc24d43c44ffbe1a1555 (patch)
tree6794f4d830ca4a784d0ba94867e80b950599c0e5 /sound/soc/codecs/cs35l56.c
parentfc0b096c92918c2ba4d76411ea763fdeb2ef6b0d (diff)
downloadlinux-7d72351a4ef6e1e763bccc24d43c44ffbe1a1555.tar.xz
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>
Diffstat (limited to 'sound/soc/codecs/cs35l56.c')
-rw-r--r--sound/soc/codecs/cs35l56.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
index 18e341744839..5ea7f419cda6 100644
--- a/sound/soc/codecs/cs35l56.c
+++ b/sound/soc/codecs/cs35l56.c
@@ -423,18 +423,19 @@ err_unlock:
}
EXPORT_SYMBOL_NS_GPL(cs35l56_irq, SND_SOC_CS35L56_CORE);
-int cs35l56_irq_request(struct cs35l56_private *cs35l56)
+int cs35l56_irq_request(struct cs35l56_private *cs35l56, int irq)
{
int ret;
- if (!cs35l56->irq)
+ if (!irq)
return 0;
- ret = devm_request_threaded_irq(cs35l56->dev, cs35l56->irq, NULL,
- cs35l56_irq,
+ ret = devm_request_threaded_irq(cs35l56->dev, irq, NULL, cs35l56_irq,
IRQF_ONESHOT | IRQF_SHARED | IRQF_TRIGGER_LOW,
"cs35l56", cs35l56);
- if (ret < 0)
+ if (!ret)
+ cs35l56->irq = irq;
+ else
dev_err(cs35l56->dev, "Failed to get IRQ: %d\n", ret);
return ret;