mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
ASoC: Intel: Skylake: Shield against no-NHLT configurations
commit 9e6c382f5a upstream.
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: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200305145314.32579-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org> # 5.4.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
754df2d334
commit
4029a29f93
@@ -182,7 +182,8 @@ void skl_nhlt_remove_sysfs(struct skl_dev *skl)
|
|||||||
{
|
{
|
||||||
struct device *dev = &skl->pci->dev;
|
struct device *dev = &skl->pci->dev;
|
||||||
|
|
||||||
sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr);
|
if (skl->nhlt)
|
||||||
|
sysfs_remove_file(&dev->kobj, &dev_attr_platform_id.attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -632,6 +632,9 @@ static int skl_clock_device_register(struct skl_dev *skl)
|
|||||||
struct platform_device_info pdevinfo = {NULL};
|
struct platform_device_info pdevinfo = {NULL};
|
||||||
struct skl_clk_pdata *clk_pdata;
|
struct skl_clk_pdata *clk_pdata;
|
||||||
|
|
||||||
|
if (!skl->nhlt)
|
||||||
|
return 0;
|
||||||
|
|
||||||
clk_pdata = devm_kzalloc(&skl->pci->dev, sizeof(*clk_pdata),
|
clk_pdata = devm_kzalloc(&skl->pci->dev, sizeof(*clk_pdata),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!clk_pdata)
|
if (!clk_pdata)
|
||||||
@@ -1090,7 +1093,8 @@ out_dsp_free:
|
|||||||
out_clk_free:
|
out_clk_free:
|
||||||
skl_clock_device_unregister(skl);
|
skl_clock_device_unregister(skl);
|
||||||
out_nhlt_free:
|
out_nhlt_free:
|
||||||
intel_nhlt_free(skl->nhlt);
|
if (skl->nhlt)
|
||||||
|
intel_nhlt_free(skl->nhlt);
|
||||||
out_free:
|
out_free:
|
||||||
skl_free(bus);
|
skl_free(bus);
|
||||||
|
|
||||||
@@ -1139,7 +1143,8 @@ static void skl_remove(struct pci_dev *pci)
|
|||||||
skl_dmic_device_unregister(skl);
|
skl_dmic_device_unregister(skl);
|
||||||
skl_clock_device_unregister(skl);
|
skl_clock_device_unregister(skl);
|
||||||
skl_nhlt_remove_sysfs(skl);
|
skl_nhlt_remove_sysfs(skl);
|
||||||
intel_nhlt_free(skl->nhlt);
|
if (skl->nhlt)
|
||||||
|
intel_nhlt_free(skl->nhlt);
|
||||||
skl_free(bus);
|
skl_free(bus);
|
||||||
dev_set_drvdata(&pci->dev, NULL);
|
dev_set_drvdata(&pci->dev, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user