ASoC: stm: stm32_i2s: request IRQ after regmap initialization
Subsystems (5)
PATCH 1/1 ASoC: stm: stm32_i2s: request IRQ after regmap initialization
The ISR accesses the managed regmap, but probe requests the IRQ before creating it. An early interrupt can reach an uninitialized regmap. Reverse-order cleanup can free the regmap while the IRQ remains active.
Request the IRQ after regmap initialization so probe unwind and removal free and synchronize it before releasing the regmap.
The teardown ordering issue was found by static analysis.
--- sound/soc/stm/stm32_i2s.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
sound/soc/stm/stm32_i2s.c +11 -12
@@ -1185,7 +1185,7 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev,struct device_node *np = pdev->dev.of_node;struct reset_control *rst;struct resource *res; -int irq, ret; +int ret;if (!np)return -ENODEV ;
@@ -1231,16 +1231,6 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev,return ret; } -/* Get irqs */ - irq =platform_get_irq (pdev,0 ); -if (irq <0 ) -return irq; - - ret =devm_request_irq (&pdev->dev, irq, stm32_i2s_isr,0 , -dev_name (&pdev->dev), i2s); -if (ret) -return ret; -/* Reset */ rst =devm_reset_control_get_optional_exclusive (&pdev->dev,NULL );if (IS_ERR (rst))
@@ -1265,7 +1255,7 @@ static int stm32_i2s_probe(struct platform_device *pdev) {struct stm32_i2s_data *i2s;u32 val; -int ret; +int irq, ret; i2s =devm_kzalloc (&pdev->dev,sizeof (*i2s),GFP_KERNEL );if (!i2s)
@@ -1291,6 +1281,15 @@ static int stm32_i2s_probe(struct platform_device *pdev)return dev_err_probe (&pdev->dev,PTR_ERR (i2s->regmap),"Regmap init error\n" ); + irq =platform_get_irq (pdev,0 ); +if (irq <0 ) +return irq; + + ret =devm_request_irq (&pdev->dev, irq, stm32_i2s_isr,0 , +dev_name (&pdev->dev), i2s); +if (ret) +return ret; + ret =snd_dmaengine_pcm_register (&pdev->dev, &stm32_i2s_pcm_config,0 );if (ret)return ret;
Mark Brown
maintainerQuoted 1 line · Myeonghun Pak
ASoC: stm:
stm32_i2s: request IRQ after regmap initialization
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
Thanks!
[1/1] ASoC: stm: stm32_i2s: request IRQ after regmap initialization
https://git.kernel.org/broonie/sound/c/1b207c85551f
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark