diff mbox

[1/5] ALSA: control: drop a sub-effect for caller's data

Message ID 1423651213-19829-2-git-send-email-o-takashi@sakamocchi.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Takashi Sakamoto Feb. 11, 2015, 10:40 a.m. UTC
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(-)
diff mbox

Patch

diff --git a/sound/core/control.c b/sound/core/control.c
index af95783..d98b990 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -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;