Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp4042994rwa; Tue, 23 Aug 2022 15:09:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR4K1/vaK7IwXWEFz+gJerNdlb0+SF/O9qIRKu5A9AF52acW2cC+9o+lGJh3XlTY4hdL8L3a X-Received: by 2002:a17:902:aa41:b0:16f:85be:f348 with SMTP id c1-20020a170902aa4100b0016f85bef348mr25899271plr.15.1661292598813; Tue, 23 Aug 2022 15:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661292598; cv=none; d=google.com; s=arc-20160816; b=04RqLc2lfEq45Z+oxnswT8P9quQdE8jPNwz75goYEPKQdHdo6IGRlreBWEgZbuM8LL 49AP334kS6ijnT4iW6pKqXfik0VLjkdEz4fCRX8wPaCebnUcSVxeDAg1bMAjYUxR3Y9Z iAWCgNWPovCRR+gnfqFhrFoHLPD/zSavxZS5SOUJUlaQjHeQZJoZwS7U9LHT5WjkmuRb /0O/bLDWOlT1e24l8pWllNvFG5EjVcwHCWK2b8PpSLwwsOI5NzxHTGmDUTG40v6eCeI8 1vqj31K0d0S8tuqB8qPSuVSTkaLvDa2ShQz5KOlL0MVMMot1hn259NWvt0lHd2bGV9Z5 kmhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=9Tyv/HjGt+kTjHUdJpqzUz7hlqhqn6nz07i1wBSdcbE=; b=JlN8IRPKO0SjwVqAf3AWjyaXONlJkz9rGm19hC6PjTgH1w9+I+Ae64ZFCQuFrr408A yKjIlHM/ILATVkouvpykzjAR32JTwlRm6TI4bdl3YyeuAUWs/ROf0yIS43N/MGXrjO9n 27Z/9Tv4dcPeQbTDw2Z62q2wyK9VTFnU+JoEnaEZKukrCcKeigHaqaTSAq4FQlrOYcq0 ECoasknGYRFaCArKXSbwHWlxZC0ktKbWoD9xSdBUz+sRfHy8EUMjned84wBXbnDNFu/3 vF9+AKu6AgEERv7056Y2wAm4+01DQLJULblvXtmi/zQUy9ceNfVmwzaq4X7Z4l65TWV0 BrLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flatmax-com.20210112.gappssmtp.com header.s=20210112 header.b=JJpoekHI; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a63c14b000000b00428a168f6c0si15991501pgi.855.2022.08.23.15.09.46; Tue, 23 Aug 2022 15:09:58 -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=@flatmax-com.20210112.gappssmtp.com header.s=20210112 header.b=JJpoekHI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231542AbiHWVc3 (ORCPT + 99 others); Tue, 23 Aug 2022 17:32:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229831AbiHWVc1 (ORCPT ); Tue, 23 Aug 2022 17:32:27 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0533F7B791 for ; Tue, 23 Aug 2022 14:32:25 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id t11-20020a17090a510b00b001fac77e9d1fso15779022pjh.5 for ; Tue, 23 Aug 2022 14:32:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flatmax-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=9Tyv/HjGt+kTjHUdJpqzUz7hlqhqn6nz07i1wBSdcbE=; b=JJpoekHIwEOPtlFjvUifgeyZ4xG06w29FzXSUvKRjB4FUkO7GrtmJZQFl3D/OQKJiD eM8aqGg+O7ONgMqFzDMWoPgMsMA26qqrI8PKcABs+EXPRkdMVA9n2oqlKGjU7qRRgXGO YEhnhWEPA8IoVaiiQ9rJjdDMARUcfZWX1P6c5OAeF9Mpt74wEkftvT9AwsP+yPw0oQ2k 2vBigX/9W+ZVwjkfLTYFYuFm8+T74lB5A64oObWHz4ZSKvb7fRezV93OonDPOtVdBBQd 0eWL6sN10RkE5UyK2hQMDB2aLSo3c1jMqVzqEct+zpzfrswUhYiksW3nXHbJFjL576JC KxTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=9Tyv/HjGt+kTjHUdJpqzUz7hlqhqn6nz07i1wBSdcbE=; b=bN6uENC50mdZDAf1X/xffreUPBOTf67GH6207682I9gFy1IH8J03x6AY2JDenHWN6O VrVP9DgYl7tJkBg8DHSJam6b+dlulNThZU3UvvFsR1fD8MnQuY872LCad3I6l6BrMymH 5PzQNp3JP1Zgy86P+nXwaeSQJbMlSU5GkAOeMO+R8k2Gc+hBTa5Q/+n9F/Rs6+C6Q3WZ khsMuvTB/cJpNpm6S089L9dK8r+EAkzEV0X1mZvvuC3I/v9/1S7lya1lCPGuSigvNkZP iDFE/VQ7c60QAmiY1MHUna9Vd3F0ogf4I6gTBZeAKksowRooD8icB+a/9QFR83NC84NT dveg== X-Gm-Message-State: ACgBeo01sQxfKPX7JEoCd5mhxXdiuVps+ux4beZ3FZwCT9z3nAKGgyFI J2KLHeSt75i0InOr3l8bzMKy0A== X-Received: by 2002:a17:90a:6001:b0:1fa:e851:3480 with SMTP id y1-20020a17090a600100b001fae8513480mr5098001pji.153.1661290345218; Tue, 23 Aug 2022 14:32:25 -0700 (PDT) Received: from ?IPV6:2406:3400:213:70c0:5c76:4280:5b6b:9ce0? ([2406:3400:213:70c0:5c76:4280:5b6b:9ce0]) by smtp.gmail.com with ESMTPSA id i62-20020a626d41000000b0052d27ccea39sm11712035pfc.19.2022.08.23.14.32.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Aug 2022 14:32:24 -0700 (PDT) Message-ID: <38754fa6-5d1f-ed9b-9c31-7a443c968cad@flatmax.com> Date: Wed, 24 Aug 2022 07:32:18 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2] ASoC: codes: src4xxx: Avoid clang -Wsometimes-uninitialized in src4xxx_hw_params() Content-Language: en-AU To: Nathan Chancellor , Liam Girdwood , Mark Brown Cc: Nick Desaulniers , Tom Rix , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, kernel test robot , "Sudip Mukherjee (Codethink)" References: <20220823151939.2493697-1-nathan@kernel.org> From: Matt Flax In-Reply-To: <20220823151939.2493697-1-nathan@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, 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 This patch looks good. On 24/8/22 01:19, Nathan Chancellor wrote: > 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. > > The datasheet does not have any default values for these regmap values > so pick some arbitrary values and print to the user that this is the > case to silence the warnings. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1691 > Reported-by: kernel test robot > Reported-by: "Sudip Mukherjee (Codethink)" > Suggested-by: Matt Flax > Signed-off-by: Nathan Chancellor > --- > > v1 -> v2: https://lore.kernel.org/20220822183101.1115095-1-nathan@kernel.org/ > > * Don't return early, just initialize the values to some arbitrary > numbers and try to hobble along, as other parts of the chip may be > functional. > > * Add message and comment to describe this situation. > > sound/soc/codecs/src4xxx.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/codecs/src4xxx.c b/sound/soc/codecs/src4xxx.c > index a8f143057b41..db4e280dd055 100644 > --- a/sound/soc/codecs/src4xxx.c > +++ b/sound/soc/codecs/src4xxx.c > @@ -280,9 +280,14 @@ static int src4xxx_hw_params(struct snd_pcm_substream *substream, > default: > /* don't error out here, > * other parts of the chip are still functional > + * Dummy initialize variables to avoid > + * -Wsometimes-uninitialized from clang. > */ > dev_info(component->dev, > - "Couldn't set the RCV PLL as this master clock rate is unknown\n"); > + "Couldn't set the RCV PLL as this master clock rate is unknown. Chosen regmap values may not match real world values.\n"); > + pj = 0x0; > + jd = 0xff; > + d = 0xff; > break; > } > ret = regmap_write(src4xxx->regmap, SRC4XXX_RCV_PLL_0F, pj); > > base-commit: 94f072748337424c9cf92cd018532a34db3a5516