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 v3 1/5] ASoC: intel: sst-mfld-platform-pcm: Use __free(kfree) for stream pointer
Date: Tue, 23 Jun 2026 21:35:21 +0200 [thread overview]
Message-ID: <fffe4925-c5aa-42a5-ab8a-d8da4989b9b9@intel.com> (raw)
In-Reply-To: <20260623105721.25865-2-phucduc.bui@gmail.com>
On 6/23/2026 12:57 PM, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
>
> Declare 'stream' with __free(kfree) so it is automatically freed when
> leaving scope. This allows direct returns from error paths and removes
> the explicit kfree(stream) call.
> Set 'stream' to NULL after ownership has been transferred to
> runtime->private_data to prevent it from being freed on the success path.
Hi Phuc,
Thank you for separating the change. The design of the patchset is off
though. __free() is by no means a requirement for the locking update -
it should be located at the back. Also, grouping changes targeting the
same driver makes the entire patchset easier to follow. Right now we
have 2 avs patches surrounded by atom ones from either side.
Last but not least, please drop the filename in the commit title. We do
not do that here - some filenames are long and the approach leaves
little space for answering the _what_ question when building a proper
commit title. "ASoC: Intel: atom:" is what you want here.
> sound/soc/intel/atom/sst-mfld-platform-pcm.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
...
> @@ -347,12 +347,19 @@ static int sst_media_open(struct snd_pcm_substream *substream,
> snd_pcm_hw_constraint_step(substream->runtime, 0,
> SNDRV_PCM_HW_PARAM_PERIODS, 2);
>
> - return snd_pcm_hw_constraint_integer(runtime,
> - SNDRV_PCM_HW_PARAM_PERIODS);
> + ret_val = snd_pcm_hw_constraint_integer(runtime,
> + SNDRV_PCM_HW_PARAM_PERIODS);
> +
> + if (ret_val < 0)
> + return ret_val;
> +
> + stream = NULL;
> +
> + return ret_val;
> +
The entire construct looks bad, unfortunately. Guess the reason comes
from its follow up - the locking update. The delta (+13, -6) isn't
exactly a good advertisement for the cleanup either. Again, I see this
patch as last in the set. Should lower the delta too.
> out_ops:
> mutex_unlock(&sst_lock);
> -out_power_up:
> - kfree(stream);
> +
> return ret_val;
> }
>
next prev parent reply other threads:[~2026-06-23 19:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 10:57 [PATCH v3 0/5] ASoC: Intel: Convert locking to guard()/scoped_guard() phucduc.bui
2026-06-23 10:57 ` [PATCH v3 1/5] ASoC: intel: sst-mfld-platform-pcm: Use __free(kfree) for stream pointer phucduc.bui
2026-06-23 19:35 ` Cezary Rojewski [this message]
2026-06-23 10:57 ` [PATCH v3 2/5] ASoC: Intel: avs: Use guard() for locking phucduc.bui
2026-06-23 19:46 ` Cezary Rojewski
2026-06-23 10:57 ` [PATCH v3 3/5] ASoC: Intel: avs: Use scoped_guard() for scoped locking phucduc.bui
2026-06-23 10:57 ` [PATCH v3 4/5] ASoC: Intel: atom: " phucduc.bui
2026-06-23 10:57 ` [PATCH v3 5/5] ASoC: Intel: atom: Use guard() for locking phucduc.bui
2026-06-23 19:56 ` Cezary Rojewski
2026-06-23 19:55 ` [PATCH v3 0/5] ASoC: Intel: Convert locking to guard()/scoped_guard() 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=fffe4925-c5aa-42a5-ab8a-d8da4989b9b9@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