Skip to contentSkip to conversation

ASoC: wm2200: add missed operations in remove and probe failure

PATCH In review Chuhong Yuan 3 participants 3 messages Nov 18, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: wm2200: add missed operations in remove and probe failure

This driver misses calls to pm_runtime_disable and regulator_bulk_disable in remove and a call to free_irq in probe failure.
Add the calls to fix it.

---
 sound/soc/codecs/wm2200.c | 5 +++++
 1 file changed, 5 insertions(+)
sound/soc/codecs/wm2200.c +5 -0
index cf64e109c658..7b087d94141b 100644
@@ -2410,6 +2410,8 @@ static int wm2200_i2c_probe(struct i2c_client *i2c,
 
 err_pm_runtime:
 	pm_runtime_disable(&i2c->dev);
+	if (i2c->irq)
+		free_irq(i2c->irq, wm2200);
 err_reset:
 	if (wm2200->pdata.reset)
 		gpio_set_value_cansleep(wm2200->pdata.reset, 0);
@@ -2426,12 +2428,15 @@ static int wm2200_i2c_remove(struct i2c_client *i2c)
 {
 	struct wm2200_priv *wm2200 = i2c_get_clientdata(i2c);
 
+	pm_runtime_disable(&i2c->dev);
 	if (i2c->irq)
 		free_irq(i2c->irq, wm2200);
 	if (wm2200->pdata.reset)
 		gpio_set_value_cansleep(wm2200->pdata.reset, 0);
 	if (wm2200->pdata.ldo_ena)
 		gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0);
+	regulator_bulk_disable(ARRAY_SIZE(wm2200->core_supplies),
+			       wm2200->core_supplies);
 
 	return 0;
 }
Signature · 1 line
2.24.0
#1 lore raw
Quoted 14 lines · Chuhong Yuan

This driver misses calls to pm_runtime_disable and regulator_bulk_disable in remove and a call to free_irq in probe failure.
Add the calls to fix it.

---
 sound/soc/codecs/wm2200.c | 5 +++++
 1 file changed, 5 insertions(+)
sound/soc/codecs/wm2200.c +0 -0
index cf64e109c658..7b087d94141b 100644

sound/soc/codecs/wm2200.c static int wm2200_i2c_probe(struct i2c_client *i2c, · line 2414

Quoted 5 lines
sound/soc/codecs/wm2200.c +2 -0
@@ -2410,6 +2410,8 @@ static int wm2200_i2c_probe(struct i2c_client *i2c,
 
 err_pm_runtime:
 	pm_runtime_disable(&i2c->dev);
+	if (i2c->irq)
+		free_irq(i2c->irq, wm2200);

Might be worth also adding a return if the request of the IRQ fails. We will get a large WARN in the log if the IRQ request failed, then we fall down this error path.

Quoted 6 lines
sound/soc/codecs/wm2200.c +0 -0
 err_reset:
 	if (wm2200->pdata.reset)
 		gpio_set_value_cansleep(wm2200->pdata.reset, 0);
@@ -2426,12 +2428,15 @@ static int wm2200_i2c_remove(struct i2c_client *i2c)
 {
 	struct wm2200_priv *wm2200 = i2c_get_clientdata(i2c);

sound/soc/codecs/wm2200.c static int wm2200_i2c_remove(struct i2c_client *i2c) · line 2439

Quoted 10 lines
sound/soc/codecs/wm2200.c +3 -0
 
+	pm_runtime_disable(&i2c->dev);
 	if (i2c->irq)
 		free_irq(i2c->irq, wm2200);
 	if (wm2200->pdata.reset)
 		gpio_set_value_cansleep(wm2200->pdata.reset, 0);
 	if (wm2200->pdata.ldo_ena)
 		gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0);
+	regulator_bulk_disable(ARRAY_SIZE(wm2200->core_supplies),
+			       wm2200->core_supplies);

This one is a bit trickier since this regulator is being controlled by PM runtime, and I don't think it necessarily leaves things in an enabled state when it is disabled.

Thanks,
Charles
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

maintainer
#2 lore raw

[alsa-devel] Applied "ASoC: wm2200: add missed operations in remove and probe failure" to the asoc tree

In reply to Chuhong Yuan

The patch

ASoC: wm2200: add missed operations in remove and probe failure

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.5

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

From 51af759a930c18d2ee450772e01c614564772b2a Mon Sep 17 00:00:00 2001
From: Chuhong Yuan <[email protected]>
Date: Mon, 18 Nov 2019 15:36:33 +0800
Subject: [PATCH] ASoC: wm2200: add missed operations in remove and probe
failure

This driver misses calls to pm_runtime_disable and regulator_bulk_disable in remove and a call to free_irq in probe failure.
Add the calls to fix it.

---
 sound/soc/codecs/wm2200.c | 5 +++++
 1 file changed, 5 insertions(+)
sound/soc/codecs/wm2200.c +5 -0
index cf64e109c658..7b087d94141b 100644
@@ -2410,6 +2410,8 @@ static int wm2200_i2c_probe(struct i2c_client *i2c,
 
 err_pm_runtime:
 	pm_runtime_disable(&i2c->dev);
+	if (i2c->irq)
+		free_irq(i2c->irq, wm2200);
 err_reset:
 	if (wm2200->pdata.reset)
 		gpio_set_value_cansleep(wm2200->pdata.reset, 0);
@@ -2426,12 +2428,15 @@ static int wm2200_i2c_remove(struct i2c_client *i2c)
 {
 	struct wm2200_priv *wm2200 = i2c_get_clientdata(i2c);
 
+	pm_runtime_disable(&i2c->dev);
 	if (i2c->irq)
 		free_irq(i2c->irq, wm2200);
 	if (wm2200->pdata.reset)
 		gpio_set_value_cansleep(wm2200->pdata.reset, 0);
 	if (wm2200->pdata.ldo_ena)
 		gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0);
+	regulator_bulk_disable(ARRAY_SIZE(wm2200->core_supplies),
+			       wm2200->core_supplies);
 
 	return 0;
 }
Signature · 6 lines
2.20.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel