On Fri, Mar 22, 2019 at 4:00 PM Takashi Iwai <tiwai@xxxxxxx> wrote: > > On Fri, 22 Mar 2019 15:06:28 +0100, > Arnd Bergmann wrote: > > > > When CONFIG_PCI is disabled, clang gets confused about the > > control flow of the switch() statement always ending up > > in the default case, and warns: > > > > sound/pci/hda/patch_ca0132.c:7558:6: error: variable 'fw_entry' is used uninitialized whenever 'if' condition is false > > [-Werror,-Wsometimes-uninitialized] > > if (!spec->alt_firmware_present) { > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > > sound/pci/hda/patch_ca0132.c:7565:42: note: uninitialized use occurs here > > dsp_os_image = (struct dsp_image_seg *)(fw_entry->data); > > ^~~~~~~~ > > sound/pci/hda/patch_ca0132.c:7558:2: note: remove the 'if' if its condition is always true > > if (!spec->alt_firmware_present) { > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > sound/pci/hda/patch_ca0132.c:7521:33: note: initialize the variable 'fw_entry' to silence this warning > > const struct firmware *fw_entry; > > ^ > > = NULL > > > > Adding an explicit check for CONFIG_PCI avoids the issue. > > Unfortunately this is not very intuitive here. > > > > Link: https://bugs.llvm.org/show_bug.cgi?id=41197#c1 > > Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> > > --- > > Any suggestions for other workarounds appreciated. If you can think > > of a better fix, please treat this as a reported-by: > > Can it be addressed by the code simplification like below, instead? > Yes, I confirmed this works as well, and it's probably more obvious what's going on, so let's use your version. Thanks, Arnd _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx https://mailman.alsa-project.org/mailman/listinfo/alsa-devel