Re: [PATCH v2] ALSA: hda/tas2781: leave hda_component in usable state

From: Takashi Iwai
Date: Sat Dec 09 2023 - 03:11:05 EST


On Fri, 08 Dec 2023 19:06:49 +0100,
Gergo Koteles wrote:
>
> @@ -612,9 +612,13 @@ static void tas2781_hda_unbind(struct device *dev,
> {
> struct tasdevice_priv *tas_priv = dev_get_drvdata(dev);
> struct hda_component *comps = master_data;
> + comps = &comps[tas_priv->index];
>
> - if (comps[tas_priv->index].dev == dev)
> - memset(&comps[tas_priv->index], 0, sizeof(*comps));
> + if (comps->dev == dev) {
> + comps->dev = NULL;
> + strscpy(comps->name, "", sizeof(comps->name));

This looks suboptimal. Either just set *comp->name = 0, or fill all
with memset().


thanks,

Takashi