• Lars-Peter Clausen's avatar
    ASoC: dapm: Avoid duplicating immutable strings · 48068961
    Lars-Peter Clausen authored
    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>
    48068961
soc-dapm.c 105 KB