Skip to content

Commit

Permalink
ASoC: simple-card: Dereference pointer for memcpy sizeof in asoc_simp…
Browse files Browse the repository at this point in the history
…le_card_probe

Commit 4fb7f4d ("ASoC: simple-card: use cpu/codec pointer on
simple_dai_props") updated {cpu,codec}_dai to be pointers in struct
simple_dai_props but didn't update these locations to dereference the
pointers.
This patch fixup it for non DT simple-card use case.

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Nathan Chancellor authored and Mark Brown committed Dec 13, 2018
1 parent f0b3f84 commit 869858f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sound/soc/generic/simple-card.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
struct asoc_simple_card_info *cinfo;
struct snd_soc_dai_link_component *codecs;
struct snd_soc_dai_link_component *platform;
int dai_idx = 0;

cinfo = dev->platform_data;
if (!cinfo) {
Expand All @@ -445,6 +446,9 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
return -EINVAL;
}

dai_props->cpu_dai = &priv->dais[dai_idx++];
dai_props->codec_dai = &priv->dais[dai_idx++];

codecs = dai_link->codecs;
codecs->name = cinfo->codec;
codecs->dai_name = cinfo->codec_dai.name;
Expand All @@ -458,10 +462,10 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
dai_link->cpu_dai_name = cinfo->cpu_dai.name;
dai_link->dai_fmt = cinfo->daifmt;
dai_link->init = asoc_simple_card_dai_init;
memcpy(&priv->dai_props->cpu_dai, &cinfo->cpu_dai,
sizeof(priv->dai_props->cpu_dai));
memcpy(&priv->dai_props->codec_dai, &cinfo->codec_dai,
sizeof(priv->dai_props->codec_dai));
memcpy(priv->dai_props->cpu_dai, &cinfo->cpu_dai,
sizeof(*priv->dai_props->cpu_dai));
memcpy(priv->dai_props->codec_dai, &cinfo->codec_dai,
sizeof(*priv->dai_props->codec_dai));
}

snd_soc_card_set_drvdata(card, priv);
Expand Down

0 comments on commit 869858f

Please sign in to comment.