[alsa-devel] [PATCH v3 2/2] topology: Fix the missing referenced elem ptr when merging private data

Lin, Mengdong mengdong.lin at intel.com
Mon Jul 25 16:17:16 CEST 2016


Sorry to interrupt you. Does this patch look good now?
This alsa-lib patch is a bug fix without any ABI changes. And it's not part of the other 2 series for BE DAI support.

Thanks
Mengdong

> -----Original Message-----
> From: mengdong.lin at linux.intel.com [mailto:mengdong.lin at linux.intel.com]
> Sent: Friday, July 22, 2016 1:13 PM
> To: alsa-devel at alsa-project.org; broonie at kernel.org
> Cc: tiwai at suse.de; Girdwood, Liam R; Lin, Mengdong; Nc, Shreyas;
> Mengdong Lin
> Subject: [PATCH v3 2/2] topology: Fix the missing referenced elem ptr when
> merging private data
> 
> From: Mengdong Lin <mengdong.lin at linux.intel.com>
> 
> tplg_copy_data() should set the valid referenced data element pointer on
> success. The caller will double check this pointer for all kinds of references,
> including controls and data.
> 
> Signed-off-by: Mengdong Lin <mengdong.lin at linux.intel.com>
> 
> diff --git a/src/topology/data.c b/src/topology/data.c index
> 768fc27..4798086 100644
> --- a/src/topology/data.c
> +++ b/src/topology/data.c
> @@ -1053,8 +1053,10 @@ int tplg_copy_data(snd_tplg_t *tplg, struct
> tplg_elem *elem,
> 
>  	tplg_dbg("Data '%s' used by '%s'\n", ref->id, elem->id);
>  	/* overlook empty private data */
> -	if (!ref_elem->data || !ref_elem->data->size)
> +	if (!ref_elem->data || !ref_elem->data->size) {
> +		ref->elem = ref_elem;
>  		return 0;
> +	}
> 
>  	old_priv = get_priv_data(elem);
>  	if (!old_priv)
> @@ -1078,6 +1080,8 @@ int tplg_copy_data(snd_tplg_t *tplg, struct
> tplg_elem *elem,
>  	ref_elem->compound_elem = 1;
>  	memcpy(priv->data + old_priv_data_size,
>  	       ref_elem->data->data, priv_data_size);
> +
> +	ref->elem = ref_elem;
>  	return 0;
>  }
> 
> --
> 2.5.0



More information about the Alsa-devel mailing list