Skip to content

Commit 69d0f88

Browse files
ujfalusibroonie
authored andcommitted
ASoC: Intel: skl_hda_dsp_generic: Use devm_kasprintf for the components string
Instead of using a global char array, allocate the string with devm_kasprintf if needed. Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20240426152123.36284-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 33e59e5 commit 69d0f88

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

sound/soc/intel/boards/skl_hda_dsp_generic.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ skl_hda_add_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *link)
9292
return ret;
9393
}
9494

95-
static char hda_soc_components[30];
96-
9795
#define IDISP_DAI_COUNT 3
9896
#define HDAC_DAI_COUNT 2
9997
#define DMIC_DAI_COUNT 2
@@ -231,9 +229,11 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
231229
card->disable_route_checks = true;
232230

233231
if (mach->mach_params.dmic_num > 0) {
234-
snprintf(hda_soc_components, sizeof(hda_soc_components),
235-
"cfg-dmics:%d", mach->mach_params.dmic_num);
236-
card->components = hda_soc_components;
232+
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
233+
"cfg-dmics:%d",
234+
mach->mach_params.dmic_num);
235+
if (!card->components)
236+
return -ENOMEM;
237237
}
238238

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

0 commit comments

Comments
 (0)