@@ -1192,11 +1192,12 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
access |= SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK;
access |= SNDRV_CTL_ELEM_ACCESS_USER;
- info->id.numid = 0;
memset(&kctl, 0, sizeof(kctl));
+ kctl.id = info->id;
+ kctl.id.numid = 0;
if (replace) {
- err = snd_ctl_remove_user_ctl(file, &info->id);
+ err = snd_ctl_remove_user_ctl(file, &kctl.id);
if (err)
return err;
}
@@ -1204,7 +1205,6 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
if (card->user_ctl_count >= MAX_USER_CONTROLS)
return -ENOMEM;
- memcpy(&kctl.id, &info->id, sizeof(info->id));
kctl.count = info->owner ? info->owner : 1;
if (info->type == SNDRV_CTL_ELEM_TYPE_ENUMERATED)
kctl.info = snd_ctl_elem_user_enum_info;
In snd_ctl_elem_add(), the given information data is changed when calling snd_ctl_elem_add(). The numid field is set as zero. This commit drops this sub-effect for a better API design. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> --- sound/core/control.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)