Skip to content

Commit

Permalink
ASoC: samsung: speyside: Free gpiod table
Browse files Browse the repository at this point in the history
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@linux.intel.com>
Fixes: da9146c ("ASoC: samsung: speyside: Convert to GPIO descriptor")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20250312-cleanup-table-v1-1-1d9a14464482@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Linus Walleij authored and Mark Brown committed Mar 12, 2025
1 parent 02e1cf7 commit 87fa872
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sound/soc/samsung/speyside.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand Down

0 comments on commit 87fa872

Please sign in to comment.