Commit b9088535 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mark Brown

ASoC: SOF: Intel: HDA: don't keep a temporary variable

fixup_tplg_name() doesn't need to keep the string, allocated for
filename - it's temporary.
Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@intel.com>
Link: https://lore.kernel.org/r/20210208233336.59449-11-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7aecf597
...@@ -581,22 +581,22 @@ static const char *fixup_tplg_name(struct snd_sof_dev *sdev, ...@@ -581,22 +581,22 @@ static const char *fixup_tplg_name(struct snd_sof_dev *sdev,
const char *dmic_str) const char *dmic_str)
{ {
const char *tplg_filename = NULL; const char *tplg_filename = NULL;
char *filename; char *filename, *tmp;
char *split_ext; const char *split_ext;
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%s.tplg", "%s%s%s.tplg",
split_ext, idisp_str, dmic_str); split_ext, idisp_str, dmic_str);
if (!tplg_filename) kfree(filename);
return NULL;
}
return tplg_filename; return tplg_filename;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment