Skip to content

Commit

Permalink
ASoC: Intel: skl_hda_dsp_generic: Use devm_kasprintf for the componen…
Browse files Browse the repository at this point in the history
…ts string

Instead of using a global char array, allocate the string with
devm_kasprintf if needed.

Reviewed-by: Bard Liao <[email protected]>
Reviewed-by: Ranjani Sridharan <[email protected]>
Reviewed-by: Kai Vehmanen <[email protected]>
Signed-off-by: Peter Ujfalusi <[email protected]>
Signed-off-by: Pierre-Louis Bossart <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
ujfalusi authored and broonie committed Apr 29, 2024
1 parent 33e59e5 commit 69d0f88
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sound/soc/intel/boards/skl_hda_dsp_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link)
return ret;
}

static char hda_soc_components[30];

#define IDISP_DAI_COUNT 3
#define HDAC_DAI_COUNT 2
#define DMIC_DAI_COUNT 2
Expand Down Expand Up @@ -231,9 +229,11 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
card->disable_route_checks = true;

if (mach->mach_params.dmic_num > 0) {
snprintf(hda_soc_components, sizeof(hda_soc_components),
"cfg-dmics:%d", mach->mach_params.dmic_num);
card->components = hda_soc_components;
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
"cfg-dmics:%d",
mach->mach_params.dmic_num);
if (!card->components)
return -ENOMEM;
}

ret = devm_snd_soc_register_card(&pdev->dev, card);
Expand Down

0 comments on commit 69d0f88

Please sign in to comment.