ALSA: hda/tas2781: Cancel async firmware request at unbind

TAS2781 HDA I2C and SPI queue RCA firmware loading from component
bind with request_firmware_nowait(). The firmware loader keeps the
callback module pinned and holds a device reference, but the callback
still uses driver-private HDA state.

Component unbind removes controls and DSP state immediately. Later
device removal tears down the TAS2781 private data, including
codec_lock. If the async firmware callback runs after unbind has
started, it can operate on state that is being torn down.

Cancel or synchronize the async firmware request before removing
controls and DSP state. A queued callback is cancelled, and an
already-running callback is allowed to finish before unbind continues.

Fixes: 5be27f1e3e ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Fixes: bb5f86ea50 ("ALSA: hda/tas2781: Add tas2781 hda SPI driver")
Cc: stable@vger.kernel.org
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260505-alsa-hda-tas2781-fw-callback-teardown-v4-2-e7c4bf930dc8@gmail.com
This commit is contained in:
Cássio Gabriel 2026-05-05 08:18:17 -03:00 committed by Takashi Iwai
parent b9bdd68b8b
commit 5367e2ad14
2 changed files with 6 additions and 0 deletions

View File

@ -588,6 +588,9 @@ static void tas2781_hda_unbind(struct device *dev,
comp->playback_hook = NULL;
}
request_firmware_nowait_cancel(tas_hda->priv->dev, tas_hda->priv,
tasdev_fw_ready);
tas2781_hda_remove_controls(tas_hda);
tasdevice_config_info_remove(tas_hda->priv);

View File

@ -742,6 +742,9 @@ static void tas2781_hda_unbind(struct device *dev, struct device *master,
comp->playback_hook = NULL;
}
request_firmware_nowait_cancel(tas_priv->dev, tas_priv,
tasdev_fw_ready);
tas2781_hda_remove_controls(tas_hda);
tasdevice_config_info_remove(tas_priv);