[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200602124439.GH30374@kadam>
Date: Tue, 2 Jun 2020 15:44:39 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Vaibhav Agarwal <vaibhav.sr@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alex Elder <elder@...nel.org>, Johan Hovold <johan@...nel.org>,
Mark Greer <mgreer@...malcreek.com>,
Takashi Iwai <tiwai@...e.com>,
Jaroslav Kysela <perex@...ex.cz>,
Mark Brown <broonie@...nel.org>,
Liam Girdwood <lgirdwood@...il.com>,
devel@...verdev.osuosl.org, alsa-devel@...a-project.org,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
linux-kernel@...r.kernel.org, greybus-dev@...ts.linaro.org
Subject: Re: [RESEND PATCH v1 5/6] staging: greybus: audio: Add helper APIs
for dynamic audio modules
On Tue, Jun 02, 2020 at 10:51:14AM +0530, Vaibhav Agarwal wrote:
> +static int gbaudio_remove_controls(struct snd_card *card, struct device *dev,
> + const struct snd_kcontrol_new *controls,
> + int num_controls, const char *prefix)
> +{
> + int i, err;
> +
> + for (i = 0; i < num_controls; i++) {
> + const struct snd_kcontrol_new *control = &controls[i];
> + struct snd_ctl_elem_id id;
> + struct snd_kcontrol *kctl;
> +
> + if (prefix)
> + snprintf(id.name, sizeof(id.name), "%s %s", prefix,
> + control->name);
> + else
> + strlcpy(id.name, control->name, sizeof(id.name));
> + id.numid = 0;
> + id.iface = control->iface;
> + id.device = control->device;
> + id.subdevice = control->subdevice;
> + id.index = control->index;
> + kctl = snd_ctl_find_id(card, &id);
> + if (!kctl) {
> + dev_err(dev, "%d: Failed to find %s\n", err,
> + control->name);
> + return -ENOENT;
I feel like this should be a continue instead of a return.
> + }
> + err = snd_ctl_remove(card, kctl);
> + if (err < 0) {
> + dev_err(dev, "%d: Failed to remove %s\n", err,
> + control->name);
> + return err;
Probably here as well. The caller doesn't actually check for errors.
> + }
> + }
> + return 0;
> +}
Powered by blists - more mailing lists