summaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/boards/bytcht_da7213.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2024-02-10 14:43:59 +0100
committerMark Brown <broonie@kernel.org>2024-02-11 16:57:23 +0000
commit7d99a70b65951108d82e1618c67abe69c3ed7720 (patch)
treeda69b6edd95f074721f6b212b433d53de12461c0 /sound/soc/intel/boards/bytcht_da7213.c
parent727b943263dc98a7aca355cc0302158218f71543 (diff)
downloadlinux-stable-7d99a70b65951108d82e1618c67abe69c3ed7720.tar.gz
linux-stable-7d99a70b65951108d82e1618c67abe69c3ed7720.tar.bz2
linux-stable-7d99a70b65951108d82e1618c67abe69c3ed7720.zip
ASoC: Intel: Boards: Fix NULL pointer deref in BYT/CHT boards
Since commit 13f58267cda3 ("ASoC: soc.h: don't create dummy Component via COMP_DUMMY()") dummy snd_soc_dai_link.codecs entries no longer have a name set. This means that when looking for the codec dai_link the machine driver can no longer unconditionally run strcmp() on snd_soc_dai_link.codecs[0].name since this may now be NULL. Add a check for snd_soc_dai_link.codecs[0].name being NULL to all BYT/CHT machine drivers to avoid NULL pointer dereferences in their probe() methods. Fixes: 13f58267cda3 ("ASoC: soc.h: don't create dummy Component via COMP_DUMMY()") Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20240210134400.24913-2-hdegoede@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/boards/bytcht_da7213.c')
-rw-r--r--sound/soc/intel/boards/bytcht_da7213.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/soc/intel/boards/bytcht_da7213.c b/sound/soc/intel/boards/bytcht_da7213.c
index 7e5eea690023..f4ac3ddd148b 100644
--- a/sound/soc/intel/boards/bytcht_da7213.c
+++ b/sound/soc/intel/boards/bytcht_da7213.c
@@ -245,7 +245,8 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
/* fix index of codec dai */
for (i = 0; i < ARRAY_SIZE(dailink); i++) {
- if (!strcmp(dailink[i].codecs->name, "i2c-DLGS7213:00")) {
+ if (dailink[i].codecs->name &&
+ !strcmp(dailink[i].codecs->name, "i2c-DLGS7213:00")) {
dai_index = i;
break;
}