mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: <phucduc.bui@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.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>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Mark Brown <broonie@kernel.org>,
	"Liam Girdwood" <liam.r.girdwood@linux.intel.com>
Subject: Re: [PATCH v2 3/4] ASoC: Intel: atom: Use scoped_guard() for scoped locking
Date: Mon, 22 Jun 2026 09:35:32 +0200	[thread overview]
Message-ID: <dc0e04f9-c43e-417c-b92b-c1db1d201e5d@intel.com> (raw)
In-Reply-To: <20260618110649.227062-4-phucduc.bui@gmail.com>

On 6/18/2026 1:06 PM, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> Convert mutex-protected sections to scoped_guard() helpers and
> simplify cleanup paths. Also use __free(kfree) for the temporary
> stream pointer in sst_media_open().
> 
> No functional change intended.

...

> diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> index f074af2499c8..ce2814e206e1 100644
> --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c
> @@ -304,7 +304,7 @@ static int sst_media_open(struct snd_pcm_substream *substream,
>   {
>   	int ret_val = 0;
>   	struct snd_pcm_runtime *runtime = substream->runtime;
> -	struct sst_runtime_stream *stream;
> +	struct sst_runtime_stream *stream __free(kfree) = NULL;

No mixing of cleanup classes.  Cleaning locking != cleaning pointers.
One action per patch.

...

> @@ -347,13 +346,10 @@ static int sst_media_open(struct snd_pcm_substream *substream,
>   	snd_pcm_hw_constraint_step(substream->runtime, 0,
>   			   SNDRV_PCM_HW_PARAM_PERIODS, 2);
>   
> +	stream = NULL;
> +

Is this needed?  If you believe so, then I'd rather see it placed 
immediately after any operation that could cause the variable to leave 
the scope.

>   	return snd_pcm_hw_constraint_integer(runtime,
>   			 SNDRV_PCM_HW_PARAM_PERIODS);
> -out_ops:
> -	mutex_unlock(&sst_lock);
> -out_power_up:
> -	kfree(stream);
> -	return ret_val;
>   }
>   
>   static void sst_media_close(struct snd_pcm_substream *substream,


  reply	other threads:[~2026-06-22  7:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18 11:06 [PATCH v2 0/4] ASoC: Intel: Convert locking to guard()/scoped_guard() phucduc.bui
2026-06-18 11:06 ` [PATCH v2 1/4] ASoC: Intel: avs: Use guard() for locking phucduc.bui
2026-06-18 11:06 ` [PATCH v2 2/4] ASoC: Intel: avs: Use scoped_guard() for scoped locking phucduc.bui
2026-06-18 17:08   ` Mark Brown
2026-06-19  7:05     ` Bui Duc Phuc
2026-06-18 11:06 ` [PATCH v2 3/4] ASoC: Intel: atom: " phucduc.bui
2026-06-22  7:35   ` Cezary Rojewski [this message]
2026-06-22  9:53     ` Bui Duc Phuc
2026-06-18 11:06 ` [PATCH v2 4/4] ASoC: Intel: atom: Use guard() for locking phucduc.bui
2026-06-22  7:36   ` Cezary Rojewski

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=dc0e04f9-c43e-417c-b92b-c1db1d201e5d@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.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=phucduc.bui@gmail.com \
    --cc=pierre-louis.bossart@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