Skip to content

Commit d339131

Browse files
simontrimmertiwai
authored andcommitted
ALSA: hda: cs35l56: Fix lifecycle of codec pointer
The codec should be cleared when the amp driver is unbound and when resuming it should be tested to prevent loading firmware into the device and ALSA in a partially configured system state. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Link: https://lore.kernel.org/r/20240531112716.25323-1-simont@opensource.cirrus.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 310fa3e commit d339131

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

sound/pci/hda/cs35l56_hda.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,8 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void *
735735
if (comps[cs35l56->index].dev == dev)
736736
memset(&comps[cs35l56->index], 0, sizeof(*comps));
737737

738+
cs35l56->codec = NULL;
739+
738740
dev_dbg(cs35l56->base.dev, "Unbound\n");
739741
}
740742

@@ -840,6 +842,9 @@ static int cs35l56_hda_system_resume(struct device *dev)
840842

841843
cs35l56->suspended = false;
842844

845+
if (!cs35l56->codec)
846+
return 0;
847+
843848
ret = cs35l56_is_fw_reload_needed(&cs35l56->base);
844849
dev_dbg(cs35l56->base.dev, "fw_reload_needed: %d\n", ret);
845850
if (ret > 0) {

0 commit comments

Comments
 (0)