From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Cc: Takashi Iwai <tiwai@suse.de>,
Claudiu Beznea <claudiu.beznea@microchip.com>,
Mark Brown <broonie@kernel.org>
Subject: [PATCH 03/11] ASoC: atmel: mchp-pdmc: Use snd_ctl_remove_id()
Date: Tue, 18 Jul 2023 16:12:56 +0200 [thread overview]
Message-ID: <20230718141304.1032-4-tiwai@suse.de> (raw)
In-Reply-To: <20230718141304.1032-1-tiwai@suse.de>
Use the standard snd_ctl_remove_id() helper instead of open code for
removing a kctl. This helps for avoiding possible races.
Cc: Claudiu Beznea <claudiu.beznea@microchip.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/soc/atmel/mchp-pdmc.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/sound/soc/atmel/mchp-pdmc.c b/sound/soc/atmel/mchp-pdmc.c
index c79c73e6791e..1a069f4cdcda 100644
--- a/sound/soc/atmel/mchp-pdmc.c
+++ b/sound/soc/atmel/mchp-pdmc.c
@@ -386,7 +386,6 @@ static int mchp_pdmc_open(struct snd_soc_component *component,
for (i = 0; i < ARRAY_SIZE(mchp_pdmc_snd_controls); i++) {
const struct snd_kcontrol_new *control = &mchp_pdmc_snd_controls[i];
struct snd_ctl_elem_id id;
- struct snd_kcontrol *kctl;
int err;
if (component->name_prefix)
@@ -400,17 +399,10 @@ static int mchp_pdmc_open(struct snd_soc_component *component,
id.device = control->device;
id.subdevice = control->subdevice;
id.index = control->index;
- kctl = snd_ctl_find_id(component->card->snd_card, &id);
- if (!kctl) {
- dev_err(component->dev, "Failed to find %s\n", control->name);
- continue;
- }
- err = snd_ctl_remove(component->card->snd_card, kctl);
- if (err < 0) {
+ err = snd_ctl_remove_id(component->card->snd_card, &id);
+ if (err < 0)
dev_err(component->dev, "%d: Failed to remove %s\n", err,
control->name);
- continue;
- }
}
return 0;
--
2.35.3
next prev parent reply other threads:[~2023-07-18 14:14 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 14:12 [PATCH 00/11] ALSA: Make control API taking controls_rwsem consistently Takashi Iwai
2023-07-18 14:12 ` [PATCH 01/11] ALSA: control: Take card->controls_rwsem in snd_ctl_rename() Takashi Iwai
2023-07-18 14:12 ` [PATCH 02/11] staging: greybus: audio_helper: Use snd_ctl_remove_id() Takashi Iwai
2023-07-18 18:00 ` Greg Kroah-Hartman
2023-07-18 14:12 ` Takashi Iwai [this message]
2023-07-18 14:45 ` [PATCH 03/11] ASoC: atmel: mchp-pdmc: " claudiu beznea
2023-07-18 14:59 ` Mark Brown
2023-07-18 14:12 ` [PATCH 04/11] ALSA: control: Take controls_rwsem lock in snd_ctl_remove() Takashi Iwai
2023-07-18 14:12 ` [PATCH 05/11] ALSA: control: Add lockdep warning to internal functions Takashi Iwai
2023-07-18 14:12 ` [PATCH 06/11] ASoC: sigmadsp: Simplify with snd_ctl_activate_id() Takashi Iwai
2023-07-18 14:58 ` Mark Brown
2023-07-18 14:13 ` [PATCH 07/11] staging: greybus: Avoid abusing controls_rwsem Takashi Iwai
2023-07-18 18:00 ` Greg Kroah-Hartman
2023-07-18 14:13 ` [PATCH 08/11] ALSA: control: Make snd_ctl_find_id() argument const Takashi Iwai
2023-07-18 14:13 ` [PATCH 09/11] ALSA: control: Introduce unlocked version for snd_ctl_find_*() helpers Takashi Iwai
2023-07-18 14:13 ` [PATCH 10/11] ALSA: control: Take lock in snd_ctl_find_id() and snd_ctl_find_numid() Takashi Iwai
2023-07-19 10:20 ` Oswald Buddenhagen
2023-07-19 10:45 ` Takashi Iwai
2023-07-18 14:13 ` [PATCH 11/11] ALSA: emu10k1: Go back and simplify with snd_ctl_find_id() Takashi Iwai
2023-07-20 8:16 ` [PATCH 00/11] ALSA: Make control API taking controls_rwsem consistently Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230718141304.1032-4-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=claudiu.beznea@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox