Re: [PATCH v3 11/12] ASoC: codecs: Add support for the generic IIO auxiliary devices

From: Herve Codina
Date: Tue Jun 13 2023 - 05:37:40 EST


Hi Andy,

On Mon, 12 Jun 2023 17:37:00 +0300
Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:

> ...
>
> > + struct snd_kcontrol_new control = {0};
>
> 0 is not needed.

Not for this one.

The variable is in stack.
Some of the structure members will be set in the code but we need to ensure
that all others are set to 0.

The full context:
--- 8< ---
static int audio_iio_aux_add_controls(struct snd_soc_component *component,
struct audio_iio_aux_chan *chan)
{
struct snd_kcontrol_new control = {0};

control.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
control.name = chan->name;
control.info = audio_iio_aux_info_volsw;
control.get = audio_iio_aux_get_volsw;
control.put = audio_iio_aux_put_volsw;
control.private_value = (unsigned long)chan;

return snd_soc_add_component_controls(component, &control, 1);
}
--- 8< ---

Thanks for the review,
Hervé