Skip to contentSkip to conversation

topology: Fix for handling widgets' references

PATCH Applied [email protected] 3 participants 5 messages Jul 22, 2016 – Jul 25, 2016

lore
Share & tools
lore
#0 lore raw

v3 cover topology: Fix for handling widgets' references

From: Mengdong Lin <[email protected]>

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(-)
Signature · 1 line
2.5.0
#1 lore raw

PATCH v3 1/2 topology: Fix inaccurate message on failure to find a widgets's reference

From: Mengdong Lin <[email protected]>

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

src/topology/dapm.c +1 -1
index 4d343b2..e3c90d8 100644
@@ -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;
Signature · 1 line
2.5.0
#2 lore raw

PATCH v3 2/2 topology: Fix the missing referenced elem ptr when merging private data

In reply to [email protected]

From: Mengdong Lin <[email protected]>

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.

src/topology/data.c +5 -1
index 768fc27..4798086 100644
@@ -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;
 }
 
Signature · 1 line
2.5.0
#3 lore raw

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

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

Quoted 46 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Friday, July 22, 2016 1:13 PM
To: [email protected]; [email protected]
Cc: [email protected]; 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 <[email protected]>

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.

src/topology/data.c index renamed from src/topology/data.c +0 -0

768fc27..4798086 100644

src/topology/data.c +3 -1
@@ -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);
src/topology/data.c +2 -1
 	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

Applied
#4 lore raw
In reply to [email protected]
Quoted 10 lines · On Fri, 22 Jul 2016 06:56:37 +0200, [email protected] wrote:

From: Mengdong Lin <[email protected]>

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.

Quoted 8 lines

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