mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Guangshuo Li <lgs201920130244@gmail.com>
Cc: <stable@vger.kernel.org>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>,
	Mark Brown <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Thorsten Blum <thorsten.blum@linux.dev>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] ASoC: Intel: atom: Fix platform device leak on probe failure
Date: Thu, 24 Sep 2026 20:31:33 +0200	[thread overview]
Message-ID: <2fc6ef64-82e6-474c-9d4e-4d291ed2a1d1@intel.com> (raw)
In-Reply-To: <20260924134932.1590967-1-lgs201920130244@gmail.com>

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);


      reply	other threads:[~2026-09-24 18:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 13:49 Guangshuo Li
2026-09-24 18:31 ` Cezary Rojewski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2fc6ef64-82e6-474c-9d4e-4d291ed2a1d1@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=lgs201920130244@gmail.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=thorsten.blum@linux.dev \
    --cc=tiwai@suse.com \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®