Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 48068961 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown
Browse files

ASoC: dapm: Avoid duplicating immutable strings



When creating a new widget from a template the name string of the template
is duplicated for the newly created widget. This is necessary because in
some cases the string might be stored on the stack or other volatile
memory locations.

But most of the time the string is static const data, which means it is
possible to use it directly without having to worry that it might get freed
or changed.

Use kstrdup_const() to handle duplicating the string. This function is
capable of detecting whether a string is immutable and if it is returns the
input without duplicating it. This will slightly reduce the runtime memory
footprint of DAPM and also speed up initialization.

Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent b97e2698
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment