* [PATCH v2] ASoC: Intel: atom: Fix platform device leak on probe failure
@ 2026-09-24 13:49 Guangshuo Li
2026-09-24 18:31 ` Cezary Rojewski
2026-09-24 18:45 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Guangshuo Li @ 2026-09-24 13:49 UTC (permalink / raw)
To: Cezary Rojewski, Liam Girdwood, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, Mark Brown, Jaroslav Kysela,
Takashi Iwai, Thorsten Blum, Guangshuo Li, linux-sound,
linux-kernel
Cc: stable
sst_acpi_probe() registers platform devices for the SST platform and
machine board using platform_device_register_data(), but does not
unregister them when later probe steps fail.
Fixes: caf94ed8629a ("ASoC: Intel: bytcr_rt5640: fixup DAI codec_name with HID")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
v2:
- Use devm_add_action_or_reset() to clean up the platform devices on
probe failure and driver removal, as suggested by Cezary Rojewski.
- Update the subsystem prefix and shorten the commit message.
sound/soc/intel/atom/sst/sst_acpi.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c
index 73624e1b138a..de1ad168008b 100644
--- a/sound/soc/intel/atom/sst/sst_acpi.c
+++ b/sound/soc/intel/atom/sst/sst_acpi.c
@@ -254,6 +254,11 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
return 0;
}
+static void sst_unregister_platform_device(void *data)
+{
+ platform_device_unregister(data);
+}
+
static int sst_acpi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -342,7 +347,10 @@ static int sst_acpi_probe(struct platform_device *pdev)
pdata->platform);
return PTR_ERR(plat_dev);
}
-
+ ret = devm_add_action_or_reset(dev, sst_unregister_platform_device,
+ plat_dev);
+ if (ret)
+ return ret;
/*
* Create platform device for sst machine driver,
* pass machine info as pdata
@@ -355,6 +363,10 @@ static int sst_acpi_probe(struct platform_device *pdev)
return PTR_ERR(mdev);
}
+ ret = devm_add_action_or_reset(dev, sst_unregister_platform_device,
+ mdev);
+ if (ret)
+ return ret;
/* Fill sst platform data */
ctx->pdata = pdata;
strscpy(ctx->firmware_name, mach->fw_filename);
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] ASoC: Intel: atom: Fix platform device leak on probe failure
2026-09-24 13:49 [PATCH v2] ASoC: Intel: atom: Fix platform device leak on probe failure Guangshuo Li
@ 2026-09-24 18:31 ` Cezary Rojewski
2026-09-24 18:45 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Cezary Rojewski @ 2026-09-24 18:31 UTC (permalink / raw)
To: Guangshuo Li
Cc: stable, Liam Girdwood, Peter Ujfalusi, Bard Liao, Kai Vehmanen,
Pierre-Louis Bossart, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Thorsten Blum, linux-sound, linux-kernel
On 9/24/2026 3:49 PM, Guangshuo Li wrote:
> sst_acpi_probe() registers platform devices for the SST platform and
> machine board using platform_device_register_data(), but does not
> unregister them when later probe steps fail.
>
> Fixes: caf94ed8629a ("ASoC: Intel: bytcr_rt5640: fixup DAI codec_name with HID")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Below nitpicks are not a must. Thank you for the update:
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
> v2:
> - Use devm_add_action_or_reset() to clean up the platform devices on
> probe failure and driver removal, as suggested by Cezary Rojewski.
> - Update the subsystem prefix and shorten the commit message.
>
> sound/soc/intel/atom/sst/sst_acpi.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c
> index 73624e1b138a..de1ad168008b 100644
> --- a/sound/soc/intel/atom/sst/sst_acpi.c
> +++ b/sound/soc/intel/atom/sst/sst_acpi.c
> @@ -254,6 +254,11 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx)
> return 0;
> }
>
> +static void sst_unregister_platform_device(void *data)
> +{
> + platform_device_unregister(data);
> +}
> +
> static int sst_acpi_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -342,7 +347,10 @@ static int sst_acpi_probe(struct platform_device *pdev)
> pdata->platform);
> return PTR_ERR(plat_dev);
> }
> -
> + ret = devm_add_action_or_reset(dev, sst_unregister_platform_device,
> + plat_dev);
Nitpick: No reason for newline here, fits 100-char limit nicely.
> + if (ret)
> + return ret;
> /*
> * Create platform device for sst machine driver,
> * pass machine info as pdata
> @@ -355,6 +363,10 @@ static int sst_acpi_probe(struct platform_device *pdev)
> return PTR_ERR(mdev);
> }
>
> + ret = devm_add_action_or_reset(dev, sst_unregister_platform_device,
> + mdev);
Ditto.
> + if (ret)
> + return ret;
> /* Fill sst platform data */
> ctx->pdata = pdata;
> strscpy(ctx->firmware_name, mach->fw_filename);
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] ASoC: Intel: atom: Fix platform device leak on probe failure
2026-09-24 13:49 [PATCH v2] ASoC: Intel: atom: Fix platform device leak on probe failure Guangshuo Li
2026-09-24 18:31 ` Cezary Rojewski
@ 2026-09-24 18:45 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-09-24 18:45 UTC (permalink / raw)
To: Cezary Rojewski, Liam Girdwood, Peter Ujfalusi, Bard Liao,
Kai Vehmanen, Pierre-Louis Bossart, Jaroslav Kysela,
Takashi Iwai, linux-sound, linux-kernel, Thorsten Blum,
Guangshuo Li
Cc: stable
On Thu, 24 Sep 2026 21:49:32 +0800, Guangshuo Li wrote:
> ASoC: Intel: atom: Fix platform device leak on probe failure
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
Thanks!
[1/1] ASoC: Intel: atom: Fix platform device leak on probe failure
https://git.kernel.org/broonie/sound/c/dcc36d766dc8
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-25 10:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-24 13:49 [PATCH v2] ASoC: Intel: atom: Fix platform device leak on probe failure Guangshuo Li
2026-09-24 18:31 ` Cezary Rojewski
2026-09-24 18:45 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®