summaryrefslogtreecommitdiffstats
path: root/sound/synth
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2024-01-20 10:42:12 +0100
committerTakashi Iwai <tiwai@suse.de>2024-01-22 13:04:22 +0100
commit1ac1b4b79bf51edcf4f25a1980334bd467880e7d (patch)
treeebc22722dec4e8aa8a48dfabbdd59073e0d0de01 /sound/synth
parent1513664f340289cf10402753110f3cff12a738aa (diff)
downloadlinux-stable-1ac1b4b79bf51edcf4f25a1980334bd467880e7d.tar.gz
linux-stable-1ac1b4b79bf51edcf4f25a1980334bd467880e7d.tar.bz2
linux-stable-1ac1b4b79bf51edcf4f25a1980334bd467880e7d.zip
ALSA: synth: Save a few bytes of memory when registering a 'snd_emux'
snd_emux_register() calls pass a string literal as the 'name' parameter. So kstrdup_const() can be used instead of kfree() to avoid a memory allocation in such cases. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/9e7b94c852a25ed4be5382e5e48a7dd77e8d4d1a.1705743706.git.christophe.jaillet@wanadoo.fr Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/synth')
-rw-r--r--sound/synth/emux/emux.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c
index 0006c3ddb51d..a82af9374852 100644
--- a/sound/synth/emux/emux.c
+++ b/sound/synth/emux/emux.c
@@ -85,7 +85,7 @@ int snd_emux_register(struct snd_emux *emu, struct snd_card *card, int index, ch
return -EINVAL;
emu->card = card;
- emu->name = kstrdup(name, GFP_KERNEL);
+ emu->name = kstrdup_const(name, GFP_KERNEL);
emu->voices = kcalloc(emu->max_voices, sizeof(struct snd_emux_voice),
GFP_KERNEL);
if (emu->name == NULL || emu->voices == NULL)
@@ -140,7 +140,7 @@ int snd_emux_free(struct snd_emux *emu)
snd_emux_delete_hwdep(emu);
snd_sf_free(emu->sflist);
kfree(emu->voices);
- kfree(emu->name);
+ kfree_const(emu->name);
kfree(emu);
return 0;
}