Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2680139rwa; Mon, 22 Aug 2022 11:39:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR5pT5NEhir+fvwOzKAtSpX+I2Dq6Fb2jc86638Pz9R17F3IvjBu90elhFkTFjwyi6VlFVul X-Received: by 2002:a17:903:110e:b0:171:3afa:e68c with SMTP id n14-20020a170903110e00b001713afae68cmr21251130plh.12.1661193563113; Mon, 22 Aug 2022 11:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661193563; cv=none; d=google.com; s=arc-20160816; b=HNMilJF1L51pTZkakkdWJIPjV9VttElOxEWATU/aOVV3bttBjEd/L3vFhYsi2gu2+g khKz/Lwi3vVxHPMNLFq7B9jApIsemc9L0MvjCYSgC2lptS5LJEbmYZcW2z807/CQBaVE AHbLFrp1mIu7B5abrjmAB/eygaOZqoyqe4kOzFPeMdoKuKx0275c8E/9Bfq89KFHcLve XO779lHdnTyzgacQK9PAyIE7cSrfnV5AUf2ay6jnsCPmlsiNXeAVhKrNseN/inwbv5Fo p4sDWBjHsF/LVAEXYamxQkGcqmtrl7HcT32+0CcrOt8RhRLVBvoCF4W22847036hW/s7 XMCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ABrCRo3x1kpTRu44zmAF1pGEATE5gVsAYAoD2LPc4/I=; b=QladNgmziewTX7cwvH8MoRDdnndqOnx34dF0VgBbTou4bHGPHvRjJC6bX4iDbTbq8a o+rFMMuwfV0W/eH9YQ30mSTygT0HsLhx3SM/i0F1EfVzFVAMzSezKiS8d8sSwgBqUviM xPJMy2mH6Ci+6Imf1fkfGpQxWWmM68dOH1oVjrG1LLcxlN5005GjjeL5PLAF04APH263 NQaIFxQyXX19fqexdC+hxxQ2M8tU/qI5/02qJBGuTI+oFrYuF0PxpgdpbOy5pOAMUt/o W128TqQ0yfUB3hUKRApfnluCEq4K01FO54lTNmrD/Z25tw9cFylxSu/MUeFoIYaighqg SE5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BJqqyAHD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb16-20020a17090b4a5000b001dc62080a06si7045992pjb.74.2022.08.22.11.39.10; Mon, 22 Aug 2022 11:39:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BJqqyAHD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237509AbiHVSb0 (ORCPT + 99 others); Mon, 22 Aug 2022 14:31:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237705AbiHVSbK (ORCPT ); Mon, 22 Aug 2022 14:31:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E05C8167E8 for ; Mon, 22 Aug 2022 11:31:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8077F612D8 for ; Mon, 22 Aug 2022 18:31:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 378F9C433D6; Mon, 22 Aug 2022 18:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661193068; bh=xXLp8vcpSHFXcg8Thw4aqS7oAXd1A4ff7T8kKAEapI8=; h=From:To:Cc:Subject:Date:From; b=BJqqyAHDoivLbBiMTx6xaDsVTE0XnbDmqovaLOU1mOvJ22j85rhVQgGVWxN7+bozo b9izsqjngBTe+tmQYon6HJMNUsEOZDAbKq9HdQuJrcyJM9XjFKFwEMHnx4ftqrT9fn hnTp7UCjOyu68bd1yjnrXAab0XBDOjohSaGNC9N0DbXP5wue/CK21Bw/hu/Eww5neC scniUIrRbM6wIdtvmTHIDNApbUBu1lMxpFYKzGOi+CseTrV46rjCcbrxsP49tG7mpm wUBm/GCHACYjoerh1kXVKVtv0pkmmWe2kWp9O/Zwipx4PdM404UcGvH27nhci/CCBz YJKw1xxP7Nd4Q== From: Nathan Chancellor To: Liam Girdwood , Mark Brown , Matt Flax Cc: Nick Desaulniers , Tom Rix , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Nathan Chancellor , kernel test robot , "Sudip Mukherjee (Codethink)" Subject: [PATCH] ASoC: codes: src4xxx: Avoid clang -Wsometimes-uninitialized in src4xxx_hw_params() Date: Mon, 22 Aug 2022 11:31:01 -0700 Message-Id: <20220822183101.1115095-1-nathan@kernel.org> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clang warns: sound/soc/codecs/src4xxx.c:280:3: error: variable 'd' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] default: ^~~~~~~ sound/soc/codecs/src4xxx.c:298:59: note: uninitialized use occurs here ret = regmap_write(src4xxx->regmap, SRC4XXX_RCV_PLL_11, d); ^ sound/soc/codecs/src4xxx.c:223:20: note: initialize the variable 'd' to silence this warning int val, pj, jd, d; ^ = 0 sound/soc/codecs/src4xxx.c:280:3: error: variable 'jd' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] default: ^~~~~~~ sound/soc/codecs/src4xxx.c:293:59: note: uninitialized use occurs here ret = regmap_write(src4xxx->regmap, SRC4XXX_RCV_PLL_10, jd); ^~ sound/soc/codecs/src4xxx.c:223:17: note: initialize the variable 'jd' to silence this warning int val, pj, jd, d; ^ = 0 sound/soc/codecs/src4xxx.c:280:3: error: variable 'pj' is used uninitialized whenever switch default is taken [-Werror,-Wsometimes-uninitialized] default: ^~~~~~~ sound/soc/codecs/src4xxx.c:288:59: note: uninitialized use occurs here ret = regmap_write(src4xxx->regmap, SRC4XXX_RCV_PLL_0F, pj); ^~ sound/soc/codecs/src4xxx.c:223:13: note: initialize the variable 'pj' to silence this warning int val, pj, jd, d; ^ = 0 3 errors generated. According to the comment in the default case, other parts of the chip are still functional without these values so just return 0 in the default case to avoid using these variables uninitialized. Link: https://github.com/ClangBuiltLinux/linux/issues/1691 Reported-by: kernel test robot Reported-by: "Sudip Mukherjee (Codethink)" Signed-off-by: Nathan Chancellor --- sound/soc/codecs/src4xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/src4xxx.c b/sound/soc/codecs/src4xxx.c index a8f143057b41..cf45caa4bf7f 100644 --- a/sound/soc/codecs/src4xxx.c +++ b/sound/soc/codecs/src4xxx.c @@ -283,7 +283,7 @@ static int src4xxx_hw_params(struct snd_pcm_substream *substream, */ dev_info(component->dev, "Couldn't set the RCV PLL as this master clock rate is unknown\n"); - break; + return 0; } ret = regmap_write(src4xxx->regmap, SRC4XXX_RCV_PLL_0F, pj); if (ret < 0) base-commit: 94f072748337424c9cf92cd018532a34db3a5516 -- 2.37.2