Commit d339131b authored by Simon Trimmer's avatar Simon Trimmer Committed by Takashi Iwai

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: default avatarSimon Trimmer <simont@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240531112716.25323-1-simont@opensource.cirrus.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 310fa3ec
...@@ -735,6 +735,8 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void * ...@@ -735,6 +735,8 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void *
if (comps[cs35l56->index].dev == dev) if (comps[cs35l56->index].dev == dev)
memset(&comps[cs35l56->index], 0, sizeof(*comps)); memset(&comps[cs35l56->index], 0, sizeof(*comps));
cs35l56->codec = NULL;
dev_dbg(cs35l56->base.dev, "Unbound\n"); dev_dbg(cs35l56->base.dev, "Unbound\n");
} }
...@@ -840,6 +842,9 @@ static int cs35l56_hda_system_resume(struct device *dev) ...@@ -840,6 +842,9 @@ static int cs35l56_hda_system_resume(struct device *dev)
cs35l56->suspended = false; cs35l56->suspended = false;
if (!cs35l56->codec)
return 0;
ret = cs35l56_is_fw_reload_needed(&cs35l56->base); ret = cs35l56_is_fw_reload_needed(&cs35l56->base);
dev_dbg(cs35l56->base.dev, "fw_reload_needed: %d\n", ret); dev_dbg(cs35l56->base.dev, "fw_reload_needed: %d\n", ret);
if (ret > 0) { if (ret > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment