Skip to content

Commit

Permalink
ASoC: SOF: Intel: HDA: don't keep a temporary variable
Browse files Browse the repository at this point in the history
fixup_tplg_name() doesn't need to keep the string, allocated for
filename - it's temporary.

Reviewed-by: Kai Vehmanen <[email protected]>
Signed-off-by: Guennadi Liakhovetski <[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
lyakh authored and broonie committed Feb 10, 2021
1 parent 7aecf59 commit b908853
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions sound/soc/sof/intel/hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,22 +581,22 @@ static const char *fixup_tplg_name(struct snd_sof_dev *sdev,
const char *dmic_str)
{
const char *tplg_filename = NULL;
char *filename;
char *split_ext;
char *filename, *tmp;
const char *split_ext;

filename = devm_kstrdup(sdev->dev, sof_tplg_filename, GFP_KERNEL);
filename = kstrdup(sof_tplg_filename, GFP_KERNEL);
if (!filename)
return NULL;

/* this assumes a .tplg extension */
split_ext = strsep(&filename, ".");
if (split_ext) {
tmp = filename;
split_ext = strsep(&tmp, ".");
if (split_ext)
tplg_filename = devm_kasprintf(sdev->dev, GFP_KERNEL,
"%s%s%s.tplg",
split_ext, idisp_str, dmic_str);
if (!tplg_filename)
return NULL;
}
kfree(filename);

return tplg_filename;
}

Expand Down

0 comments on commit b908853

Please sign in to comment.