diff mbox series

[04/12] ASoC: intel: sof-sdw: Move check for valid group id to get_dailink_info

Message ID 20230808132013.889419-4-ckeepax@opensource.cirrus.com (mailing list archive)
State Accepted
Commit 87608d3e9de18331c5d3c9ecb915b0ff3d03c089
Headers show
Series [01/12] ASoC: intel: sof_sdw: Printk's should end with a newline | expand

Commit Message

Charles Keepax Aug. 8, 2023, 1:20 p.m. UTC
Move the check for a valid group id into get_dailink_info as
well. This does cause a slight change in behaviour in that the system
will return an error rather than just ignoring the link with an
invalid group id. There are presently no systems with invalid group
ids in mainline and failing seems more appropriate since it will
better highlight the code needs fixing.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 sound/soc/intel/boards/sof_sdw.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index 268629d5505c3..b250fb7be4bff 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -1074,6 +1074,11 @@  static int get_dailink_info(struct device *dev,
 			}
 
 			endpoint = adr_link->adr_d[i].endpoints;
+			if (endpoint->aggregated && !endpoint->group_id) {
+				dev_err(dev, "invalid group id on link %x\n",
+					adr_link->mask);
+				return -EINVAL;
+			}
 
 			for (j = 0; j < codec_info->dai_num; j++) {
 				/* count DAI number for playback and capture */
@@ -1666,11 +1671,6 @@  static int sof_card_dai_links_create(struct snd_soc_card *card)
 			const struct snd_soc_acpi_endpoint *endpoint;
 
 			endpoint = adr_link->adr_d[i].endpoints;
-			if (endpoint->aggregated && !endpoint->group_id) {
-				dev_err(dev, "invalid group id on link %x\n",
-					adr_link->mask);
-				continue;
-			}
 
 			/* this group has been generated */
 			if (endpoint->aggregated &&