]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ASoC: SOF: topology: Fix null pointer dereference
authorJulien Massot <julien.massot@collabora.com>
Tue, 29 Apr 2025 09:19:22 +0000 (11:19 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 30 Apr 2025 00:38:23 +0000 (09:38 +0900)
The "get_function_tplg_files" function is only applicable to
ACPI-based devices (sof_pdata->machine and not sof_pdata->of_machine).
Skip this check for OF-based devices to avoid a NULL pointer
dereference in snd_sof_load_topology().

Fixes: 6d5997c412cc ("ASoC: SOF: topology: load multiple topologies")
Reviewed-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Signed-off-by: Julien Massot <julien.massot@collabora.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://patch.msgid.link/20250429-fixup-of-sof-topology-v4-1-ff692244d64c@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/topology.c

index e19ba94f2c80a43731b90351bacfde2720db50ed..5d3ee3a86392c5a3fbfd05f83acc99b102c8cf61 100644 (file)
@@ -2481,7 +2481,7 @@ int snd_sof_load_topology(struct snd_soc_component *scomp, const char *file)
        if (!tplg_files)
                return -ENOMEM;
 
-       if (sof_pdata->machine->get_function_tplg_files) {
+       if (sof_pdata->machine && sof_pdata->machine->get_function_tplg_files) {
                tplg_cnt = sof_pdata->machine->get_function_tplg_files(scomp->card,
                                                                       sof_pdata->machine,
                                                                       tplg_filename_prefix,