Skip to contentSkip to conversation

ASoC: core: Make snd_soc_find_component() more robust

PATCH In review Mark Brown 1 participant 2 messages Jan 14, 2019 – Jan 15, 2019

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

PATCH 1/1 ASoC: core: Make snd_soc_find_component() more robust

There are some use cases where you're checking for a lot of things on a card and it makes sense that you might end up trying to call snd_soc_find_component() without either a name or an of_node. Currently in that case we try to dereference the name and crash but it's more useful to allow the caller to just treat that as a case where we don't find anything, that error handling will already exist.

Inspired by a patch from Ajit Pandey fixing some callers.

Fixes 8780cf1142a5 ("ASoC: soc-core: defer card probe until all component is added to list")
---
 sound/soc/soc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
index cdcc417c94ca..b680c673c553 100644
@@ -742,7 +742,7 @@ static struct snd_soc_component *soc_find_component(
 		if (of_node) {
 			if (component->dev->of_node == of_node)
 				return component;
-		} else if (strcmp(component->name, name) == 0) {
+		} else if (name && strcmp(component->name, name) == 0) {
 			return component;
 		}
 	}
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

Applied "ASoC: core: Make snd_soc_find_component() more robust" to the asoc tree

The patch

ASoC: core: Make snd_soc_find_component() more robust

has been applied to the asoc tree at

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 5a7b2aabc1aa0393f067d9325ada96fdf67f8cb7 Mon Sep 17 00:00:00 2001

From: Mark Brown <[email protected]>
Date: Mon, 14 Jan 2019 23:29:36 +0000
Subject: [PATCH] ASoC: core: Make snd_soc_find_component() more robust

There are some use cases where you're checking for a lot of things on a card and it makes sense that you might end up trying to call snd_soc_find_component() without either a name or an of_node. Currently in that case we try to dereference the name and crash but it's more useful to allow the caller to just treat that as a case where we don't find anything, that error handling will already exist.

Inspired by a patch from Ajit Pandey fixing some callers.

Fixes 8780cf1142a5 ("ASoC: soc-core: defer card probe until all component is added to list")
---
 sound/soc/soc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
index cdcc417c94ca..b680c673c553 100644
@@ -742,7 +742,7 @@ static struct snd_soc_component *soc_find_component(
 		if (of_node) {
 			if (component->dev->of_node == of_node)
 				return component;
-		} else if (strcmp(component->name, name) == 0) {
+		} else if (name && strcmp(component->name, name) == 0) {
 			return component;
 		}
 	}
Signature · 1 line
2.20.1