lkml.org 
[lkml]   [2020]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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;
> +}

\
 
 \ /
  Last update: 2020-06-02 14:46    [W:0.086 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site