Skip to content

Commit 9f81212

Browse files
bardliaoranj063
authored andcommitted
ASoC: sdca: test adev before calling acpi_dev_for_each_child
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: 3a513da ("ASoC: SDCA: add initial module") Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
1 parent 3077baf commit 9f81212

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

sound/soc/sdca/sdca_functions.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ void sdca_lookup_functions(struct sdw_slave *slave)
165165
struct device *dev = &slave->dev;
166166
struct acpi_device *adev = to_acpi_device_node(dev->fwnode);
167167

168+
if (!adev) {
169+
dev_info(dev, "No matching ACPI device found, ignoring peripheral\n");
170+
return;
171+
}
168172
acpi_dev_for_each_child(adev, find_sdca_function, &slave->sdca_data);
169173
}
170174
EXPORT_SYMBOL_NS(sdca_lookup_functions, SND_SOC_SDCA);

0 commit comments

Comments
 (0)