forked from Minki/linux
ASoC: amd: Add error checking to probe function
The acp_audio_dma does not perform sufficient error checking in its probe
function. This can result in crashes if a critical error path is
encountered.
Fixes: 7c31335a03
("ASoC: AMD: add AMD ASoC ACP 2.x DMA driver")
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Dominik Behr <dbehr@chromium.org>
Cc: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
4fbd8d194f
commit
fdaa451107
@ -1051,6 +1051,11 @@ static int acp_audio_probe(struct platform_device *pdev)
|
||||
struct resource *res;
|
||||
const u32 *pdata = pdev->dev.platform_data;
|
||||
|
||||
if (!pdata) {
|
||||
dev_err(&pdev->dev, "Missing platform data\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
audio_drv_data = devm_kzalloc(&pdev->dev, sizeof(struct audio_drv_data),
|
||||
GFP_KERNEL);
|
||||
if (audio_drv_data == NULL)
|
||||
@ -1058,6 +1063,8 @@ static int acp_audio_probe(struct platform_device *pdev)
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
audio_drv_data->acp_mmio = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(audio_drv_data->acp_mmio))
|
||||
return PTR_ERR(audio_drv_data->acp_mmio);
|
||||
|
||||
/* The following members gets populated in device 'open'
|
||||
* function. Till then interrupts are disabled in 'acp_init'
|
||||
|
Loading…
Reference in New Issue
Block a user