[alsa-devel] [PATCH] ALSA: control: obsolete 'already present' messaging because it's caller's fault

Takashi Sakamoto o-takashi at sakamocchi.jp
Sun Feb 8 11:29:08 CET 2015


When drivers or userspace applications add a duplicated control, snd
module outputs error message and return -EBUSY.

This state is a bug in driver or application, therefore the messaging
should be done by them, not by snd module.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 sound/core/control.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/sound/core/control.c b/sound/core/control.c
index d482997..8906b66 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -357,18 +357,10 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
 
 	down_write(&card->controls_rwsem);
 	if (snd_ctl_find_id(card, &id)) {
-		up_write(&card->controls_rwsem);
-		dev_err(card->dev, "control %i:%i:%i:%s:%i is already present\n",
-					id.iface,
-					id.device,
-					id.subdevice,
-					id.name,
-					id.index);
 		err = -EBUSY;
 		goto error;
 	}
 	if (snd_ctl_find_hole(card, kcontrol->count) < 0) {
-		up_write(&card->controls_rwsem);
 		err = -ENOMEM;
 		goto error;
 	}
@@ -388,6 +380,7 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
 	return 0;
 
  error:
+	up_write(&card->controls_rwsem);
 	snd_ctl_free_one(kcontrol);
 	return err;
 }
-- 
2.1.0



More information about the Alsa-devel mailing list