* [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
0 siblings, 1 reply; 2+ 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] 2+ 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
0 siblings, 0 replies; 2+ 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] 2+ messages in thread
end of thread, other threads:[~2026-09-24 18:31 UTC | newest]
Thread overview: 2+ 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
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®