Re: [PATCH v2 4/5] soundwire: intel: add sdw_stream_setup helper for .startup callback
From: Vinod Koul
Date: Wed Feb 12 2020 - 05:12:42 EST
On 14-01-20, 17:42, Pierre-Louis Bossart wrote:
> From: Rander Wang <rander.wang@xxxxxxxxxxxxxxx>
>
> The sdw stream is allocated and stored in dai to share the sdw runtime
> information.
>
> Signed-off-by: Rander Wang <rander.wang@xxxxxxxxxxxxxxx>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
> ---
> drivers/soundwire/intel.c | 64 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 64 insertions(+)
>
> diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
> index 999aa2cd9fea..c498812522ab 100644
> --- a/drivers/soundwire/intel.c
> +++ b/drivers/soundwire/intel.c
> @@ -617,6 +617,68 @@ static int intel_post_bank_switch(struct sdw_bus *bus)
> * DAI routines
> */
>
> +static int sdw_stream_setup(struct snd_pcm_substream *substream,
> + struct snd_soc_dai *dai)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct sdw_stream_runtime *sdw_stream = NULL;
> + char *name;
> + int i, ret;
> +
> + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
> + name = kasprintf(GFP_KERNEL, "%s-Playback", dai->name);
> + else
> + name = kasprintf(GFP_KERNEL, "%s-Capture", dai->name);
I don't see name being feed on success. It is nicely freed on error but on
success it should be freed when you close
--
~Vinod