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: 10865845 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0B566C2 for ; Fri, 22 Mar 2019 14:08:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFEED28F95 for ; Fri, 22 Mar 2019 14:08:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B398E2A80D; Fri, 22 Mar 2019 14:08:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CEE2E28F95 for ; Fri, 22 Mar 2019 14:08:28 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1FB7D1631; Fri, 22 Mar 2019 15:07:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1FB7D1631 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1553263707; bh=sjElZMeFNDwJR39sRdQIuWhFAyrShmoC7w0Ugs74RVg=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=F/qv6/DceFfguMl0XMyhXpw/FJzcnfLjlQ37C84LJ/gzCArNmtFImVTuKG6QYfM4s LvC77YCFPZ09bq5iBXp/wTLzkYiZOaWAj/UB33qsILtz1Q2o5sGrYVWWXrYybYO6y5 62snonicTcRhA2gGVJQ8wPUknZNGTx1iMLv5v37E= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9712EF896FF; Fri, 22 Mar 2019 15:07:36 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 46D89F89684; Fri, 22 Mar 2019 15:07:35 +0100 (CET) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CEAD7F8078F for ; Fri, 22 Mar 2019 15:07:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CEAD7F8078F 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 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-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== Cc: alsa-devel@alsa-project.org, Arnd Bergmann , Alastair Bridgewater , Nick Desaulniers , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor Subject: [alsa-devel] [PATCH] ALSA: hda/ca0132: work around clang -Wuninitialized warning X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Nathan Chancellor Reviewed-by: Nathan Chancellor --- 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(-) 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)