[PATCH] ASoC: samsung: speyside: Free gpiod table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



We create a gpio descriptor table but it needs to be free:ed
when the module is removed. Add a devm_ action to do the job.

Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Fixes: da9146c19b17 ("ASoC: samsung: speyside: Convert to GPIO descriptor")
Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
---
 sound/soc/samsung/speyside.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index f781e2be2fd496924045597b750ab7f2249d8977..9262e56265842e7f8e5b5a740115cb5fbb0c537a 100644
--- a/sound/soc/samsung/speyside.c
+++ b/sound/soc/samsung/speyside.c
@@ -347,6 +347,11 @@ static struct gpiod_lookup_table wm8996_gpiod_table = {
 	},
 };
 
+static void speyside_gpiod_table_action(void *data)
+{
+	gpiod_remove_lookup_table(&wm8996_gpiod_table);
+}
+
 static int speyside_probe(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = &speyside;
@@ -355,6 +360,11 @@ static int speyside_probe(struct platform_device *pdev)
 	card->dev = &pdev->dev;
 
 	gpiod_add_lookup_table(&wm8996_gpiod_table);
+	ret = devm_add_action_or_reset(&pdev->dev, speyside_gpiod_table_action,
+				       NULL);
+	if (ret)
+		return ret;
+
 	ret = devm_snd_soc_register_card(&pdev->dev, card);
 	if (ret)
 		dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");

---
base-commit: eea255893718268e1ab852fb52f70c613d109b99
change-id: 20250312-cleanup-table-ce8607f2b1ef

Best regards,
-- 
Linus Walleij <linus.walleij@xxxxxxxxxx>





[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux