sdca_lookup_functions may be called by a Peripheral that is not listed
in the ACPI table. Testing adev is required to avoid kernel NULL pointer
dereference.
Fixes: 3a513da1ae33 ("ASoC: SDCA: add initial module")
Signed-off-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>
Reviewed-by: Liam Girdwood <liam.r.girdwood@xxxxxxxxx>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx>
---
sound/soc/sdca/sdca_functions.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/sdca/sdca_functions.c b/sound/soc/sdca/sdca_functions.c
index a6ad57430dd4..e6e5629c7054 100644
--- a/sound/soc/sdca/sdca_functions.c
+++ b/sound/soc/sdca/sdca_functions.c
@@ -165,6 +165,10 @@ void sdca_lookup_functions(struct sdw_slave *slave)
struct device *dev = &slave->dev;
struct acpi_device *adev = to_acpi_device_node(dev->fwnode);
+ if (!adev) {
+ dev_info(dev, "No matching ACPI device found, ignoring peripheral\n");
+ return;
+ }
acpi_dev_for_each_child(adev, find_sdca_function, &slave->sdca_data);
}
EXPORT_SYMBOL_NS(sdca_lookup_functions, SND_SOC_SDCA);
--
2.43.0
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]