All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] topology: Fix for handling widgets' references
@ 2016-07-22  4:56 mengdong.lin
  2016-07-22  5:12 ` [PATCH v3 1/2] topology: Fix inaccurate message on failure to find a widgets's reference mengdong.lin
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: mengdong.lin @ 2016-07-22  4:56 UTC (permalink / raw)
  To: alsa-devel, broonie
  Cc: tiwai, mengdong.lin, Mengdong Lin, liam.r.girdwood, shreyas.nc

From: Mengdong Lin <mengdong.lin@linux.intel.com>

This series fixes an error when merging a widget's private data and an
inaccurate output message.

History:
v2: Split v1 into 2 patches. And set the valid reference element value
    only on success.

v3: Also set valid refernced element ptr when skipping data copy for an
    empty data reference, which is not an error.

Mengdong Lin (2):
  topology: Fix inaccurate message on failure to find a widgets's
    reference
  topology: Fix the missing referenced elem ptr when merging private
    data

 src/topology/dapm.c | 2 +-
 src/topology/data.c | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

-- 
2.5.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] topology: Fix inaccurate message on failure to find a widgets's reference
  2016-07-22  4:56 [PATCH v3 0/2] topology: Fix for handling widgets' references mengdong.lin
@ 2016-07-22  5:12 ` mengdong.lin
  2016-07-22  5:12 ` [PATCH v3 2/2] topology: Fix the missing referenced elem ptr when merging private data mengdong.lin
  2016-07-25  9:56 ` [PATCH v3 0/2] topology: Fix for handling widgets' references Takashi Iwai
  2 siblings, 0 replies; 5+ messages in thread
From: mengdong.lin @ 2016-07-22  5:12 UTC (permalink / raw)
  To: alsa-devel, broonie
  Cc: tiwai, mengdong.lin, Mengdong Lin, liam.r.girdwood, shreyas.nc

From: Mengdong Lin <mengdong.lin@linux.intel.com>

A widget may have references to control or data elements. So the message
should not only use "control" here.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>

diff --git a/src/topology/dapm.c b/src/topology/dapm.c
index 4d343b2..e3c90d8 100644
--- a/src/topology/dapm.c
+++ b/src/topology/dapm.c
@@ -201,7 +201,7 @@ static int tplg_build_widget(snd_tplg_t *tplg,
 		}
 
 		if (!ref->elem) {
-			SNDERR("error: cannot find control '%s'"
+			SNDERR("error: cannot find '%s'"
 				" referenced by widget '%s'\n",
 				ref->id, elem->id);
 			return -EINVAL;
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] topology: Fix the missing referenced elem ptr when merging private data
  2016-07-22  4:56 [PATCH v3 0/2] topology: Fix for handling widgets' references mengdong.lin
  2016-07-22  5:12 ` [PATCH v3 1/2] topology: Fix inaccurate message on failure to find a widgets's reference mengdong.lin
@ 2016-07-22  5:12 ` mengdong.lin
  2016-07-25 14:17   ` Lin, Mengdong
  2016-07-25  9:56 ` [PATCH v3 0/2] topology: Fix for handling widgets' references Takashi Iwai
  2 siblings, 1 reply; 5+ messages in thread
From: mengdong.lin @ 2016-07-22  5:12 UTC (permalink / raw)
  To: alsa-devel, broonie
  Cc: tiwai, mengdong.lin, Mengdong Lin, liam.r.girdwood, shreyas.nc

From: Mengdong Lin <mengdong.lin@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@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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 0/2] topology: Fix for handling widgets' references
  2016-07-22  4:56 [PATCH v3 0/2] topology: Fix for handling widgets' references mengdong.lin
  2016-07-22  5:12 ` [PATCH v3 1/2] topology: Fix inaccurate message on failure to find a widgets's reference mengdong.lin
  2016-07-22  5:12 ` [PATCH v3 2/2] topology: Fix the missing referenced elem ptr when merging private data mengdong.lin
@ 2016-07-25  9:56 ` Takashi Iwai
  2 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2016-07-25  9:56 UTC (permalink / raw)
  To: mengdong.lin
  Cc: mengdong.lin, alsa-devel, broonie, liam.r.girdwood, shreyas.nc

On Fri, 22 Jul 2016 06:56:37 +0200,
mengdong.lin@linux.intel.com wrote:
> 
> From: Mengdong Lin <mengdong.lin@linux.intel.com>
> 
> This series fixes an error when merging a widget's private data and an
> inaccurate output message.
> 
> History:
> v2: Split v1 into 2 patches. And set the valid reference element value
>     only on success.
> 
> v3: Also set valid refernced element ptr when skipping data copy for an
>     empty data reference, which is not an error.
> 
> Mengdong Lin (2):
>   topology: Fix inaccurate message on failure to find a widgets's
>     reference
>   topology: Fix the missing referenced elem ptr when merging private
>     data

Applied both patches.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/2] topology: Fix the missing referenced elem ptr when merging private data
  2016-07-22  5:12 ` [PATCH v3 2/2] topology: Fix the missing referenced elem ptr when merging private data mengdong.lin
@ 2016-07-25 14:17   ` Lin, Mengdong
  0 siblings, 0 replies; 5+ messages in thread
From: Lin, Mengdong @ 2016-07-25 14:17 UTC (permalink / raw)
  To: Takashi Sakamoto, tiwai@suse.de; +Cc: alsa-devel@alsa-project.org

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@linux.intel.com [mailto:mengdong.lin@linux.intel.com]
> Sent: Friday, July 22, 2016 1:13 PM
> To: alsa-devel@alsa-project.org; broonie@kernel.org
> Cc: tiwai@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@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@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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-25 14:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-22  4:56 [PATCH v3 0/2] topology: Fix for handling widgets' references mengdong.lin
2016-07-22  5:12 ` [PATCH v3 1/2] topology: Fix inaccurate message on failure to find a widgets's reference mengdong.lin
2016-07-22  5:12 ` [PATCH v3 2/2] topology: Fix the missing referenced elem ptr when merging private data mengdong.lin
2016-07-25 14:17   ` Lin, Mengdong
2016-07-25  9:56 ` [PATCH v3 0/2] topology: Fix for handling widgets' references Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.