diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2025-04-14 04:00:45 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2025-04-25 15:19:59 +0300 |
commit | 4814a8e03a18d44ab4df77bd79a9fe224e0e2abc (patch) | |
tree | 417fba5fa39f8d5309eb7259b0a22901b4834270 | |
parent | cce73cf7cc56a04cf0dd1e1f93b4002c00751ebe (diff) | |
download | linux-4814a8e03a18d44ab4df77bd79a9fe224e0e2abc.tar.xz |
ASoC: fsl: don't set link->platform if not needed
imx_card_parse_of() allocs 2 components for CPU/Platform (A)
static int imx_card_parse_of(...)
{
...
for_each_child_of_node(...) {
dlc = devm_kzalloc(...);
...
link->cpus = &dlc[0];
(A) link->platforms = &dlc[1];
}
...
}
The link might be used as DPCM backend, in such case, link->plaforms
will be not used. The driver overwrite it as Dummy DAI (B).
} else if (!strncmp(link->name, "HiFi-ASRC-BE", 12)) {
/* DPCM backend */
link->no_pcm = 1;
link->platforms->of_node = NULL;
(B) link->platforms->name = "snd-soc-dummy";
}
If it was not used for generic DMAEngine, we can just remove it.
By this patch, created dlc (A) will be just wasted, but it won't leak.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87cydfr1z6.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/fsl/imx-card.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index 45e000f61ecc..9e668ae68039 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -670,9 +670,12 @@ static int imx_card_parse_of(struct imx_card_data *data) } } else if (!strncmp(link->name, "HiFi-ASRC-BE", 12)) { /* DPCM backend */ + /* + * No need to have link->platforms. alloced dlc[1] will be just wasted, + * but it won't leak. + */ link->no_pcm = 1; - link->platforms->of_node = NULL; - link->platforms->name = "snd-soc-dummy"; + link->platforms = NULL; link->be_hw_params_fixup = be_hw_params_fixup; link->ops = &imx_aif_ops_be; |