ASoC: SOF: Intel: atom: don't keep a temporary string in fixup_tplg_name
fixup_tplg_name() doesn't need to keep the string, allocated for
filename - it's temporary.
Inspired by similar change for hda:
commit b9088535e1
("ASoC: SOF: Intel: HDA: don't keep a temporary variable")
Reviewed-by: Bard Liao <yung-chuan.liao@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/20220715145216.277003-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
b9cb044f35
commit
27b196c19c
|
@ -274,22 +274,22 @@ static const char *fixup_tplg_name(struct snd_sof_dev *sdev,
|
||||||
const char *ssp_str)
|
const char *ssp_str)
|
||||||
{
|
{
|
||||||
const char *tplg_filename = NULL;
|
const char *tplg_filename = NULL;
|
||||||
char *filename;
|
const char *split_ext;
|
||||||
char *split_ext;
|
char *filename, *tmp;
|
||||||
|
|
||||||
filename = devm_kstrdup(sdev->dev, sof_tplg_filename, GFP_KERNEL);
|
filename = kstrdup(sof_tplg_filename, GFP_KERNEL);
|
||||||
if (!filename)
|
if (!filename)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* this assumes a .tplg extension */
|
/* this assumes a .tplg extension */
|
||||||
split_ext = strsep(&filename, ".");
|
tmp = filename;
|
||||||
if (split_ext) {
|
split_ext = strsep(&tmp, ".");
|
||||||
|
if (split_ext)
|
||||||
tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL,
|
tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL,
|
||||||
"%s-%s.tplg",
|
"%s-%s.tplg",
|
||||||
split_ext, ssp_str);
|
split_ext, ssp_str);
|
||||||
if (!tplg_filename)
|
kfree(filename);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return tplg_filename;
|
return tplg_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue