diff options
| author | Richard Fitzgerald <rf@opensource.cirrus.com> | 2026-03-10 17:18:12 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-03-10 17:52:52 +0300 |
| commit | 2c7c27025374abbdeda201ad103ddf27e8079aec (patch) | |
| tree | 3cdeb903d3620c08b2756e3f9b4d1e2699373bb3 | |
| parent | bf2d44d07de726b0393439cb4d4defc5cf89a4fc (diff) | |
| download | linux-2c7c27025374abbdeda201ad103ddf27e8079aec.tar.xz | |
ASoC: wm_adsp: Remove duplicated code to find firmware file
The 3rd search case in wm_adsp_request_firmware_files() does exactly the
same bin file searches as the case immediately above it. Merge the
conditional from the 3rd case into the second case so the duplicated code
can be removed.
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://patch.msgid.link/20260310141817.1871794-6-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | sound/soc/codecs/wm_adsp.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 346ede149a9e..a3f297510526 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -828,9 +828,10 @@ VISIBLE_IF_KUNIT int wm_adsp_request_firmware_files(struct wm_adsp *dsp, } if (system_name) { - if (!wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename, - cirrus_dir, system_name, - NULL, "wmfw")) { + ret = wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename, + cirrus_dir, system_name, + NULL, "wmfw"); + if (!ret || dsp->wmfw_optional) { if (suffix) wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, cirrus_dir, system_name, @@ -840,24 +841,10 @@ VISIBLE_IF_KUNIT int wm_adsp_request_firmware_files(struct wm_adsp *dsp, wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, cirrus_dir, system_name, NULL, "bin"); - return 0; - } - } - /* Check system-specific bin without wmfw before falling back to generic */ - if (dsp->wmfw_optional && system_name) { - if (suffix) - wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, - cirrus_dir, system_name, - suffix, "bin"); - - if (!*coeff_firmware) - wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename, - cirrus_dir, system_name, - NULL, "bin"); - - if (*coeff_firmware) - return 0; + if (*wmfw_firmware || (dsp->wmfw_optional && *coeff_firmware)) + return 0; + } } /* Check legacy location */ |
