ASoC: SDCA: Fix errors in IRQ cleanup
Subsystems (3)
Charles Keepax
maintainerPATCH 1/1 ASoC: SDCA: Fix errors in IRQ cleanup
IRQs are enabled through sdca_irq_populate() from component probe using devm_request_threaded_irq(), this however means the IRQs can persist if the sound card is torn down. Some of the IRQ handlers store references to the card and the kcontrols which can then fail. Some detail of the crash was explained in [1].
Generally it is not advised to use devm outside of bus probe, so the code is updated to not use devm. The IRQ requests are not moved to bus probe time as it makes passing the snd_soc_component into the IRQs very awkward and would the require a second step once the component is available, so it is simpler to just register the IRQs at this point, even though that necessitates some manual cleanup.
---
Hi Gaggery,
Could you try out this fix see if it resolves the issues you are seeing?
Thanks,
Charles
include/sound/sdca_interrupts.h | 5 ++ sound/soc/sdca/sdca_class_function.c | 9 ++++ sound/soc/sdca/sdca_interrupts.c | 77 ++++++++++++++++++++++++++-- 3 files changed, 87 insertions(+), 4 deletions(-)
include/sound/sdca_interrupts.h +5 -0
@@ -69,6 +69,8 @@ struct sdca_interrupt_info {int sdca_irq_request (struct device *dev,struct sdca_interrupt_info *interrupt_info,int sdca_irq,const char *name,irq_handler_t handler,void *data); +void sdca_irq_free (struct device *dev,struct sdca_interrupt_info *interrupt_info, +int sdca_irq,const char *name,void *data); int sdca_irq_data_populate(struct device *dev, struct regmap *function_regmap, struct snd_soc_component *component, struct sdca_function_data *function,
@@ -81,6 +83,9 @@ int sdca_irq_populate_early(struct device *dev, struct regmap *function_regmap,int sdca_irq_populate (struct sdca_function_data *function,struct snd_soc_component *component,struct sdca_interrupt_info *info); +void sdca_irq_cleanup (struct sdca_function_data *function, +struct snd_soc_component *component, +struct sdca_interrupt_info *info);struct sdca_interrupt_info *sdca_irq_allocate (struct device *dev,struct regmap *regmap,int irq);
sound/soc/sdca/sdca_class_function.c +9 -0
@@ -198,6 +198,14 @@ static int class_function_component_probe(struct snd_soc_component *component)return sdca_irq_populate (drv->function, component, core->irq_info); } +static void class_function_component_remove (struct snd_soc_component *component) +{ +struct class_function_drv *drv =snd_soc_component_get_drvdata (component); +struct sdca_class_drv *core = drv->core; + +sdca_irq_cleanup (drv->function, component, core->irq_info); +} +static int class_function_set_jack (struct snd_soc_component *component,struct snd_soc_jack *jack,void *d) {
@@ -209,6 +217,7 @@ static int class_function_set_jack(struct snd_soc_component *component,static const struct snd_soc_component_driver class_function_component_drv = { .probe = class_function_component_probe, + .remove = class_function_component_remove, .endianness =1 , };
sound/soc/sdca/sdca_interrupts.c +73 -4
107 lines not on this page · raw message
Signature · 1 line
2.47.3
Mark Brown
maintainerQuoted 6 lines · Charles Keepax
IRQs are enabled through
sdca_irq_populate()from component probe usingdevm_request_threaded_irq(), this however means the IRQs can persist if the sound card is torn down. Some of the IRQ handlers store references to the card and the kcontrols which can then fail. Some detail of the crash was explained in [1].
Quoted 8 lines
Generally it is not advised to use devm outside of bus probe, so the code is updated to not use devm. The IRQ requests are not moved to bus probe time as it makes passing the
snd_soc_componentinto the IRQs very awkward and would the require a second step once the component is available, so it is simpler to just register the IRQs at this point, even though that necessitates some manual cleanup.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: SDCA: Fix errors in IRQ cleanup
https://git.kernel.org/broonie/misc/c/4e53116437e9
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
Mark Brown
maintainerQuoted 1 line · Charles Keepax
ASoC: SDCA: Fix errors in IRQ cleanup
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.0
Thanks!
[1/1] ASoC: SDCA: Fix errors in IRQ cleanup
https://git.kernel.org/broonie/sound/c/4e53116437e9
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