diff mbox series

[02/16] ALSA: hda/tas2781: leave hda_component in usable state

Message ID 1be369f5a007c9f77bce7a33748ef428152894d7.1701906455.git.soyer@irl.hu (mailing list archive)
State Superseded
Headers show
Series ALSA: hda/tas2781: Add tas2563 support | expand

Commit Message

Gergo Koteles Dec. 6, 2023, 11:59 p.m. UTC
Unloading then loading the module causes a panic.
Set only previously modified fields to null.

Signed-off-by: Gergo Koteles <soyer@irl.hu>
---
 sound/pci/hda/tas2781_hda_i2c.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c
index fb802802939e..077a01521eef 100644
--- a/sound/pci/hda/tas2781_hda_i2c.c
+++ b/sound/pci/hda/tas2781_hda_i2c.c
@@ -613,8 +613,11 @@  static void tas2781_hda_unbind(struct device *dev,
 	struct tasdevice_priv *tas_priv = dev_get_drvdata(dev);
 	struct hda_component *comps = master_data;
 
-	if (comps[tas_priv->index].dev == dev)
-		memset(&comps[tas_priv->index], 0, sizeof(*comps));
+	if (comps[tas_priv->index].dev == dev) {
+		comps[tas_priv->index].dev = NULL;
+		strscpy(comps->name, "", sizeof(comps->name));
+		comps[tas_priv->index].playback_hook = NULL;
+	}
 
 	tasdevice_config_info_remove(tas_priv);
 	tasdevice_dsp_remove(tas_priv);