Message ID | 20230720082554.31891-3-tiwai@suse.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | ALSA: Cleanup with snd_ctl_add_followers() | expand |
On Thu, Jul 20, 2023 at 10:25:52AM +0200, Takashi Iwai wrote: >+ err = snd_ctl_add_followers(ac97->bus->card, kctl, followers); >+ if (err < 0) >+ return err; > > return 0; > this seems a bit pointless - you could just return snd_ctl_add_followers(... directly. (more instances may be affected, but i don't see it due to little diff context.) > } regards
On Thu, 20 Jul 2023 12:35:22 +0200, Oswald Buddenhagen wrote: > > On Thu, Jul 20, 2023 at 10:25:52AM +0200, Takashi Iwai wrote: > > + err = snd_ctl_add_followers(ac97->bus->card, kctl, followers); > > + if (err < 0) > > + return err; > > > > return 0; > > > this seems a bit pointless - you could just > return snd_ctl_add_followers(... > directly. Right, this can be simplified. Will fold into the v2 patch. thanks, Takashi
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index ccfd9c7bf900..09626aed967d 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c @@ -3440,7 +3440,6 @@ static int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name, const char * const *followers) { struct snd_kcontrol *kctl; - const char * const *s; int err; kctl = snd_ctl_make_virtual_master(name, tlv); @@ -3450,19 +3449,10 @@ static int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name, if (err < 0) return err; - for (s = followers; *s; s++) { - struct snd_kcontrol *sctl; + err = snd_ctl_add_followers(ac97->bus->card, kctl, followers); + if (err < 0) + return err; - sctl = snd_ac97_find_mixer_ctl(ac97, *s); - if (!sctl) { - dev_dbg(ac97->bus->card->dev, - "Cannot find follower %s, skipped\n", *s); - continue; - } - err = snd_ctl_add_follower(kctl, sctl); - if (err < 0) - return err; - } return 0; }
Instead of open-code, use the new standard helper to manage vmaster stuff for code simplification. Except for a debug print, there should be no functional change. Signed-off-by: Takashi Iwai <tiwai@suse.de> --- sound/pci/ac97/ac97_patch.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-)