Skip to content

Commit 4fc90fb

Browse files
committed
ALSA: hda/ca0132 - Simplify alt firmware loading code
ca0132 codec driver loads the firmware selectively depending on the model in addition to the fallback of the default firmware. The code works good, but a minor problem is that the current code seems confusing for Clang where it spews a warning about uninitialized variable. This patch simplifies the code flow for such a false-positive warning. After this refactoring, the ca0132_spec.alt_firmware_present field is no longer used, hence it's eliminated as well. Reported-and-tested-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent ca0214e commit 4fc90fb

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

sound/pci/hda/patch_ca0132.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,6 @@ struct ca0132_spec {
10051005
unsigned int scp_resp_header;
10061006
unsigned int scp_resp_data[4];
10071007
unsigned int scp_resp_count;
1008-
bool alt_firmware_present;
10091008
bool startup_check_entered;
10101009
bool dsp_reload;
10111010

@@ -7518,7 +7517,7 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec)
75187517
bool dsp_loaded = false;
75197518
struct ca0132_spec *spec = codec->spec;
75207519
const struct dsp_image_seg *dsp_os_image;
7521-
const struct firmware *fw_entry;
7520+
const struct firmware *fw_entry = NULL;
75227521
/*
75237522
* Alternate firmwares for different variants. The Recon3Di apparently
75247523
* can use the default firmware, but I'll leave the option in case
@@ -7529,33 +7528,26 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec)
75297528
case QUIRK_R3D:
75307529
case QUIRK_AE5:
75317530
if (request_firmware(&fw_entry, DESKTOP_EFX_FILE,
7532-
codec->card->dev) != 0) {
7531+
codec->card->dev) != 0)
75337532
codec_dbg(codec, "Desktop firmware not found.");
7534-
spec->alt_firmware_present = false;
7535-
} else {
7533+
else
75367534
codec_dbg(codec, "Desktop firmware selected.");
7537-
spec->alt_firmware_present = true;
7538-
}
75397535
break;
75407536
case QUIRK_R3DI:
75417537
if (request_firmware(&fw_entry, R3DI_EFX_FILE,
7542-
codec->card->dev) != 0) {
7538+
codec->card->dev) != 0)
75437539
codec_dbg(codec, "Recon3Di alt firmware not detected.");
7544-
spec->alt_firmware_present = false;
7545-
} else {
7540+
else
75467541
codec_dbg(codec, "Recon3Di firmware selected.");
7547-
spec->alt_firmware_present = true;
7548-
}
75497542
break;
75507543
default:
7551-
spec->alt_firmware_present = false;
75527544
break;
75537545
}
75547546
/*
75557547
* Use default ctefx.bin if no alt firmware is detected, or if none
75567548
* exists for your particular codec.
75577549
*/
7558-
if (!spec->alt_firmware_present) {
7550+
if (!fw_entry) {
75597551
codec_dbg(codec, "Default firmware selected.");
75607552
if (request_firmware(&fw_entry, EFX_FILE,
75617553
codec->card->dev) != 0)

0 commit comments

Comments
 (0)