diff options
| author | Laurentiu Mihalcea <[email protected]> | 2025-02-11 22:50:18 +0000 |
|---|---|---|
| committer | Mark Brown <[email protected]> | 2025-02-12 13:46:00 +0000 |
| commit | f22ba3561daa792dd138ed543e0bf48efe0b999c (patch) | |
| tree | 9fc60aa6a06c76fe4ce476d020f633c5b04a671f /sound/soc/sof/imx/imx-common.c | |
| parent | ASoC: fsl_micfil: Add decimation filter bypass mode support (diff) | |
| download | kernel-f22ba3561daa792dd138ed543e0bf48efe0b999c.tar.gz kernel-f22ba3561daa792dd138ed543e0bf48efe0b999c.zip | |
ASoC: SOF: imx-common: set sdev->pdata->hw_pdata after common is alloc'd
'imx_unregister_action' uses 'sdev->pdata->hw_pdata' to fetch the pointer
to the common data structure. As such, if 'sdev->pdata->hw_pdata' is not
set before adding 'imx_unregister_action' to the devres list, we risk
derefrencing a NULL pointer if any of the calls between
'devm_add_action_or_reset' and 'sdev->pdata->hw_pdata = common' fails.
Set 'sdev->pdata->hw_pdata' to point to 'common' as soon as 'common' is
allocated.
Fixes: 651e0ed391b1 (" ASoC: SOF: imx: introduce more common structures and functions")
Signed-off-by: Laurentiu Mihalcea <[email protected]>
Reviewed-by: Frank Li <[email protected]>
Reviewed-by: Daniel Baluta <[email protected]>
Link: https://patch.msgid.link/[email protected]
Reviewed-by: Frank Li <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'sound/soc/sof/imx/imx-common.c')
| -rw-r--r-- | sound/soc/sof/imx/imx-common.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/sof/imx/imx-common.c b/sound/soc/sof/imx/imx-common.c index 82057af1436c..c3594815e60e 100644 --- a/sound/soc/sof/imx/imx-common.c +++ b/sound/soc/sof/imx/imx-common.c @@ -378,6 +378,7 @@ static int imx_probe(struct snd_sof_dev *sdev) if (!common) return dev_err_probe(sdev->dev, -ENOMEM, "failed to allocate common data\n"); + sdev->pdata->hw_pdata = common; common->ipc_dev = platform_device_register_data(sdev->dev, "imx-dsp", PLATFORM_DEVID_NONE, @@ -436,7 +437,6 @@ static int imx_probe(struct snd_sof_dev *sdev) imx_dsp_set_data(common->ipc_handle, sdev); sdev->num_cores = 1; - sdev->pdata->hw_pdata = common; sdev->mailbox_bar = SOF_FW_BLK_TYPE_SRAM; sdev->dsp_box.offset = get_chip_info(sdev)->ipc_info.boot_mbox_offset; |
