From patchwork Fri Mar 22 14:06:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 160896 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp857604jan; Fri, 22 Mar 2019 07:08:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIdtMsM9/hBiGyEK9Teh5FReGcmbhj6thMuYlWBXoy/0YPuJPavZ1frD3bpnSVcks+IA0e X-Received: by 2002:a17:902:2c83:: with SMTP id n3mr9976277plb.281.1553263695508; Fri, 22 Mar 2019 07:08:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553263695; cv=none; d=google.com; s=arc-20160816; b=uPVanyW9FCGCu6CdojX7zYcAd/DVvt52ItcvNd2yRQmBGo+jjRKWF897CmBwpc/axj 6HXPlX79tL52clleJTo3tLT7sWfApFFlLMu3jLH+dKuaG/peQnPTd9TaM7sxg53/Pd6b eahY6dgIMmTV8xn6hInjAj8gH9jVXFb6vgytsvbEJkZsxcwoikab6O2nfJil3G0Ao5FH FHJSofNIlJVAA+cb1qXUgQdpD3hUOIs2KSnaIsvACdbHYysGiStgjqKze9C/FDoF4tsf E3ruS4Hap0MrTd6bwEgDaK1RjZXR5aBvl3ry0TPhodgPGsQ+rccg+AdWUj6naXcmmVet op3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=kgmKXNpoNHKAmoQ/v0+UpXZmm1x/KO6D7D5O8hHyB+A=; b=GeIrs/lCA+YZRvGCUSXM9rxhy0se1BWCNP6wKOM7k2orVGv1zl7wfingOK0VNXbdIf HzrW7PhqzQWT4LGacvsM9+qGQSsrpDZbJv2S7DfdbsQnU2hcWh+QW3M382KYwZwmW6Ny pbxeYI+oUWgCDkQ1XaifvkVlAGOVjfqtX7g727rKaxCcyPQIEXpa0VaD1awXmdf/t9q9 SQBmhiBiCSVnktU7O6eXRTrG3f3DwZR5nZKCXAsZQx99XWRCYne1VFgGWipBojNJHdge JtuJ3GqXTxjdB56cUVCL2qYPoJ9GDlujXZmU/a2RIe5fJ5+w6tZQaYETINVSIMXCoK1x oGuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62si7546037ple.393.2019.03.22.07.08.15; Fri, 22 Mar 2019 07:08:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728084AbfCVOIO (ORCPT + 31 others); Fri, 22 Mar 2019 10:08:14 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:53411 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727487AbfCVOIN (ORCPT ); Fri, 22 Mar 2019 10:08:13 -0400 Received: from wuerfel.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1N7xml-1gujVI0uTD-014xXn; Fri, 22 Mar 2019 15:06:51 +0100 From: Arnd Bergmann To: Takashi Iwai , Connor McAdams , Takashi Sakamoto Cc: clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , Arnd Bergmann , Jaroslav Kysela , Alastair Bridgewater , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ALSA: hda/ca0132: work around clang -Wuninitialized warning Date: Fri, 22 Mar 2019 15:06:28 +0100 Message-Id: <20190322140649.197027-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:evwjwt7mhgRLU3GN33j/cnsVOiV9wjtnPs/Dj8C9wsXFF7C7+eG KQftvmfclIpjzA1lm+KnVgJGY+aizj2DBCfem1Hi0U7EjOTEllryll26CsB42wPv6dsbF1E CEIvqkUZzFlTa2gp36kUqL23R0B+GNzD7O6D2N+Ac8hlmvWTh6S7+mXtd2jmlVenCxHydYA hQnSGqwKjuRwRm1r4vEgg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:3wEGlyncInU=:JLa7x3tbCMH4nqij1shbri 1xq5ojC/sg+a7kY5uMO4xkVsvGVDMMsQjuxcjIDblPP60GITXocCVHQ7xFhEQSjbmLnVjwnYp Tgc0jmUlMoTcYZVKy+Y3HX+MKSoewt7gEjeHNgy9/BOSrXDlcwIKRcLiA0qL/Y7mVF+G7heDu uYK2wNYWGLtdJ5XZbGZeI6ERlXCRI5RboGYefcKeOm8dzERDQtZhg+6v+hPtEIQ3M9SnWT79L eCP4HoljvvJPPWe6foESCtfg9UfiP/KSWjLBWOn5pnLEnNwIbv8rlDjCqFq9oksq40iM6EkGs naZpyz9qPuBvFcSvquPL0IaKftJIBZ0425E1E+GqQjKGAnV5F8zq+Z5nzlqnVjVbmoVbI4ucg 7b3WhkNCsEgmN7R9yjmjEYi3wAC7ym1iUzebRZ1D7CSAx8dDZDjvI+4umCKD6S3nE2rq2MYDn CH1bzybw0w39JvLmb+18jLZwMV5tIbRKB1X29xuiY5rEql06RzMR4onrsxj07lowf62E4iX3J /zgk7tLeMbz+Ai6i/IZJCsA79VIY2CyOA9oYjYJz7Fn/8xJo21w5l7N2GLodHwW4YKq1jrt6Y kEVn/7/uSczGN2zo3QeF9X9zoIa48+0xni9FsLfjaGxluG2y8zd+FATDyIW2/Z7WoGbEmsLNs pqmrbH/cksXIOVsAQ3HytSRx1gD9AqfADM4d6qDrZvER6o034q4SWHCVfdlIolDSwGdEE9AR2 v624crwjxrDeOLPCOxBOtTH1HgikuOnqJVYnGw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Any suggestions for other workarounds appreciated. If you can think of a better fix, please treat this as a reported-by: --- sound/pci/hda/patch_ca0132.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 Reviewed-by: Nathan Chancellor Reviewed-by: Nathan Chancellor diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 29882bda7632..415b16b7db70 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -7555,7 +7555,7 @@ static bool ca0132_download_dsp_images(struct hda_codec *codec) * Use default ctefx.bin if no alt firmware is detected, or if none * exists for your particular codec. */ - if (!spec->alt_firmware_present) { + if (!IS_ENABLED(CONFIG_PCI) || !spec->alt_firmware_present) { codec_dbg(codec, "Default firmware selected."); if (request_firmware(&fw_entry, EFX_FILE, codec->card->dev) != 0)