summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/wm_adsp_fw_find_test.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-05-07 08:55:15 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-05-07 08:55:15 -0700
commit19cbc75c56c0ed4fa3f637e3c41a98895a68dfae (patch)
tree5dbb8e9287d0494e4fb67bbd636fc259a91c1dfa /sound/soc/codecs/wm_adsp_fw_find_test.c
parent1e38f888f9f070591e54c690e78f2ff8affa8881 (diff)
parent06bc7ff0a1e0f2b0102e1314e3527a7ec0997851 (diff)
Merge tag 'sound-7.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/soundHEADmaster
Pull sound fixes from Takashi Iwai: "Again a collection of small fixes, mostly for device-specific ones. The only big LOC is about the removal of pretty old dead code in ab8500 codec driver, while the rest all nice small changes. Core / API: - Fix race in deferred fasync state checks - Fix UMP group filtering in sequencer ASoC: - cs35l56: fixes for driver cleanup and error paths - tas2764/2770: workaround for bogus temperature readings - wm_adsp: fixes for firmware unit tests - amd-yc: more DMI quirks for laptops - Minor fixes for fsl_xcvr and spacemit HD-Audio: - Mute LED and speaker quirks for HP, Lenovo, and Xiaomi laptops USB-audio: - New device-specific quirks (Motu, JBL, AlphaTheta, Razer) - Fix of MIDI2 playback on resume Others: - Firewire-tascam control event fix - Minor cleanups and fixes for sparc/dbri and pcmtest" * tag 'sound-7.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (28 commits) ASoC: cs35l56: Destroy workqueue in probe error path ASoC: cs35l56: Don't use devres to unregister component ALSA: sparc/dbri: add missing fallthrough ALSA: core: Serialize deferred fasync state checks ALSA: hda/realtek: Add mute LED fixup for HP Pavilion 15-cs1xxx ALSA: seq: Fix UMP group 16 filtering ASoC: wm_adsp_fw_find_test: Clear searched_fw_files in find-by-index test ASoC: wm_adsp_fw_find_test: Redirect wm_adsp_release_firmware_files() ASoC: tas2770: Deal with bogus initial temperature value ASoC: tas2764: Deal with bogus initial temperature register value ALSA: usb-audio: add clock quirk for Motu 1248 ALSA: usb-audio: midi2: Restart output URBs on resume ALSA: hda/realtek: Fix mute and mic-mute LEDs for HP Envy X360 15-fh0xxx ALSA: usb-audio: Add quirk flags for JBL Pebbles ALSA: firewire-tascam: Do not drop unread control events ALSA: usb-audio: Add quirk flags for AlphaTheta EUPHONIA ASoC: fsl_xcvr: Fix event generation for cached controls ASoC: sdw_utils: avoid the SDCA companion function not supported failure ASoC: amd: yc: Add HP OMEN Gaming Laptop 16-ap0xxx product line in quirk table ASoC: cs35l56: Fix out-of-bounds in dev_err() in cs35l56_read_onchip_spkid() ...
Diffstat (limited to 'sound/soc/codecs/wm_adsp_fw_find_test.c')
-rw-r--r--sound/soc/codecs/wm_adsp_fw_find_test.c57
1 files changed, 47 insertions, 10 deletions
diff --git a/sound/soc/codecs/wm_adsp_fw_find_test.c b/sound/soc/codecs/wm_adsp_fw_find_test.c
index d0c7fb30a95d..ae686dc4fa94 100644
--- a/sound/soc/codecs/wm_adsp_fw_find_test.c
+++ b/sound/soc/codecs/wm_adsp_fw_find_test.c
@@ -45,6 +45,34 @@ struct wm_adsp_fw_find_test_params {
/* Dummy struct firmware to return from wm_adsp_request_firmware_files */
static const struct firmware wm_adsp_find_test_dummy_firmware;
+static void wm_adsp_fw_find_test_release_firmware_files_stub(struct wm_adsp_fw_files *fw)
+{
+ /*
+ * fw->wmfw.firmware and fw->coeff.firmware allocated by this KUnit
+ * test are dummies not allocated by the real request_firmware() call
+ * so they must not be passed to release_firmware().
+ * This function replaces wm_adsp_release_firmware_files().
+ */
+
+ if (!fw)
+ return;
+
+ kfree(fw->wmfw.filename);
+ kfree(fw->coeff.filename);
+
+ fw->wmfw.firmware = NULL;
+ fw->coeff.firmware = NULL;
+ fw->wmfw.filename = NULL;
+ fw->coeff.filename = NULL;
+}
+
+static void wm_adsp_free_found_fw(struct kunit *test)
+{
+ struct wm_adsp_fw_find_test *priv = test->priv;
+
+ wm_adsp_fw_find_test_release_firmware_files_stub(&priv->found_fw);
+}
+
/* Simple lookup of a filename in a list of names */
static int wm_adsp_fw_find_test_firmware_request_simple_stub(const struct firmware **firmware,
const char *filename,
@@ -97,9 +125,14 @@ static void wm_adsp_fw_find_test_pick_file(struct kunit *test)
kunit_activate_static_stub(test,
wm_adsp_firmware_request,
wm_adsp_fw_find_test_firmware_request_simple_stub);
+ kunit_activate_static_stub(test,
+ wm_adsp_release_firmware_files,
+ wm_adsp_fw_find_test_release_firmware_files_stub);
ret = wm_adsp_request_firmware_files(dsp, &priv->found_fw);
kunit_deactivate_static_stub(test, wm_adsp_firmware_request);
+ kunit_deactivate_static_stub(test, wm_adsp_release_firmware_files);
+
KUNIT_EXPECT_EQ_MSG(test, ret,
(params->expect_wmfw || params->expect_bin) ? 0 : -ENOENT,
"%s\n", priv->searched_fw_files);
@@ -173,10 +206,13 @@ static void wm_adsp_fw_find_test_search_order(struct kunit *test)
kunit_activate_static_stub(test,
wm_adsp_firmware_request,
wm_adsp_fw_find_test_firmware_request_stub);
+ kunit_activate_static_stub(test,
+ wm_adsp_release_firmware_files,
+ wm_adsp_fw_find_test_release_firmware_files_stub);
wm_adsp_request_firmware_files(dsp, &priv->found_fw);
-
kunit_deactivate_static_stub(test, wm_adsp_firmware_request);
+ kunit_deactivate_static_stub(test, wm_adsp_release_firmware_files);
KUNIT_EXPECT_STREQ(test, priv->searched_fw_files, params->expected_searches);
@@ -201,6 +237,7 @@ static void wm_adsp_fw_find_test_find_firmware_byindex(struct kunit *test)
dsp->cs_dsp.name = "cs1234";
dsp->part = "dsp1";
+
for (dsp->fw = 0;; dsp->fw++) {
fw_name = wm_adsp_get_fwf_name_by_index(dsp->fw);
if (!fw_name)
@@ -209,14 +246,22 @@ static void wm_adsp_fw_find_test_find_firmware_byindex(struct kunit *test)
kunit_activate_static_stub(test,
wm_adsp_firmware_request,
wm_adsp_fw_find_test_firmware_request_stub);
+ kunit_activate_static_stub(test,
+ wm_adsp_release_firmware_files,
+ wm_adsp_fw_find_test_release_firmware_files_stub);
wm_adsp_request_firmware_files(dsp, &priv->found_fw);
+
kunit_deactivate_static_stub(test, wm_adsp_firmware_request);
+ kunit_deactivate_static_stub(test, wm_adsp_release_firmware_files);
KUNIT_EXPECT_NOT_NULL_MSG(test,
strstr(priv->searched_fw_files, fw_name),
"fw#%d Did not find '%s' in '%s'\n",
dsp->fw, fw_name, priv->searched_fw_files);
+
+ wm_adsp_free_found_fw(test);
+ memset(priv->searched_fw_files, 0, sizeof(priv->searched_fw_files));
}
}
@@ -255,15 +300,7 @@ static int wm_adsp_fw_find_test_case_init(struct kunit *test)
static void wm_adsp_fw_find_test_case_exit(struct kunit *test)
{
- struct wm_adsp_fw_find_test *priv = test->priv;
-
- /*
- * priv->found_wmfw_firmware and priv->found_bin_firmware are
- * dummies not allocated by the real request_firmware() call they
- * must not be passed to release_firmware().
- */
- kfree(priv->found_fw.wmfw.filename);
- kfree(priv->found_fw.coeff.filename);
+ wm_adsp_free_found_fw(test);
}
static void wm_adsp_fw_find_test_param_desc(const struct wm_adsp_fw_find_test_params *param,