Unverified Commit 9e6c382f authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown
Browse files

ASoC: Intel: Skylake: Shield against no-NHLT configurations



Some configurations expose no NHLT table at all within their
/sys/firmware/acpi/tables. To prevent NULL-dereference errors from
occurring, adjust probe flow and append additional safety checks in
functions involved in NHLT lifecycle.

Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200305145314.32579-5-cezary.rojewski@intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent e603f11d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@ void skl_nhlt_remove_sysfs(struct skl_dev *skl)
{
	struct device *dev = &skl->pci->dev;

	if (skl->nhlt)
		sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr);
}

+7 −2
Original line number Diff line number Diff line
@@ -633,6 +633,9 @@ static int skl_clock_device_register(struct skl_dev *skl)
	struct platform_device_info pdevinfo = {NULL};
	struct skl_clk_pdata *clk_pdata;

	if (!skl->nhlt)
		return 0;

	clk_pdata = devm_kzalloc(&skl->pci->dev, sizeof(*clk_pdata),
							GFP_KERNEL);
	if (!clk_pdata)
@@ -1074,6 +1077,7 @@ out_dsp_free:
out_clk_free:
	skl_clock_device_unregister(skl);
out_nhlt_free:
	if (skl->nhlt)
		intel_nhlt_free(skl->nhlt);
out_free:
	skl_free(bus);
@@ -1123,6 +1127,7 @@ static void skl_remove(struct pci_dev *pci)
	skl_dmic_device_unregister(skl);
	skl_clock_device_unregister(skl);
	skl_nhlt_remove_sysfs(skl);
	if (skl->nhlt)
		intel_nhlt_free(skl->nhlt);
	skl_free(bus);
	dev_set_drvdata(&pci->dev, NULL);