Skip to content

Commit 2c7c270

Browse files
rfvirgilbroonie
authored andcommitted
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>
1 parent bf2d44d commit 2c7c270

1 file changed

Lines changed: 7 additions & 20 deletions

File tree

sound/soc/codecs/wm_adsp.c

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -828,9 +828,10 @@ VISIBLE_IF_KUNIT int wm_adsp_request_firmware_files(struct wm_adsp *dsp,
828828
}
829829

830830
if (system_name) {
831-
if (!wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename,
832-
cirrus_dir, system_name,
833-
NULL, "wmfw")) {
831+
ret = wm_adsp_request_firmware_file(dsp, wmfw_firmware, wmfw_filename,
832+
cirrus_dir, system_name,
833+
NULL, "wmfw");
834+
if (!ret || dsp->wmfw_optional) {
834835
if (suffix)
835836
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
836837
cirrus_dir, system_name,
@@ -840,24 +841,10 @@ VISIBLE_IF_KUNIT int wm_adsp_request_firmware_files(struct wm_adsp *dsp,
840841
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
841842
cirrus_dir, system_name,
842843
NULL, "bin");
843-
return 0;
844-
}
845-
}
846844

847-
/* Check system-specific bin without wmfw before falling back to generic */
848-
if (dsp->wmfw_optional && system_name) {
849-
if (suffix)
850-
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
851-
cirrus_dir, system_name,
852-
suffix, "bin");
853-
854-
if (!*coeff_firmware)
855-
wm_adsp_request_firmware_file(dsp, coeff_firmware, coeff_filename,
856-
cirrus_dir, system_name,
857-
NULL, "bin");
858-
859-
if (*coeff_firmware)
860-
return 0;
845+
if (*wmfw_firmware || (dsp->wmfw_optional && *coeff_firmware))
846+
return 0;
847+
}
861848
}
862849

863850
/* Check legacy location */

0 commit comments

Comments
 (0)