Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp4040565rwa; Tue, 23 Aug 2022 15:07:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR73pe7kGewyeoFv6eD09GjohNVjxV0hP1DyRAUd++47bLU8WiNTwv/Y44X3pjnihuqELDos X-Received: by 2002:a17:906:ef8f:b0:731:4a01:7781 with SMTP id ze15-20020a170906ef8f00b007314a017781mr1060748ejb.268.1661292442186; Tue, 23 Aug 2022 15:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661292442; cv=none; d=google.com; s=arc-20160816; b=jSF5GP9uQv/mhPYhzaoOMKAxwSNCHG229rdKXiNzEwHNZKgvmioWTkyay+3B9VN1He 9cVv+lsNAbRFc+7+4EWrP3SLzDCT65196K8N+obs1pneF3m6BCw4UZ0sWbvRogemPJ5J hlI0lZs+IxUV+Oiy7z4K1cgSqMdyOIh5zDLbn7zVNMnvwUhjpVQwyNnyy+ge7J0+twdV 7Q93uRK9UGhnOHDc26/YbF+Vvnz6QT4GpLKA1u/Llc3+6uh8yXSBW5QhF60QbKkBbwLo Abuof8uG7gWRtPOdiV6BzsCHq96E6DZHRNG5UmQSWcgiA1eAHkioUowJSwv6zLBpj4IG YNGQ== 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=FnXtIAn0IyAxdQUTX7XZR7kL9caPa6K/jTtIbR9ZQeI=; b=bPaBzjqvmfgMatMM9eRuFqY/7n0Iq/aw61UNaq/Xi9+Ppzyk9ImrPj8lGA1akTuu1c fJhQZyMMHWqe3EWg/ooYkOqv5f+zaHZ3xMud0IQOrWC0uxIvZiZws1T4Eouk/eC4hMDF cjOKtwwTcQ5cJ155SUnZOAz6u/kmjBDhYMfkCXajbaYAAaTsk9Qfs4UDcITlsptqhAFq YlavOzGr07tjRPihvOuPF+vPTe2TffzY6VKCUVF41VhxknjFahDvwBOnUqLjB3QFWoYl J3WMtrlbOqndYyk+97x4THSlJuCfEPdnUh+kcNRoM5S1+NMlrj1OkRQFS4qgyjDEvPdh eKhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@flatmax-com.20210112.gappssmtp.com header.s=20210112 header.b=obG8zpTD; 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 w19-20020a05640234d300b00445eaa43e06si3798289edc.376.2022.08.23.15.06.55; Tue, 23 Aug 2022 15:07:22 -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=obG8zpTD; 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 S230033AbiHWVxV (ORCPT + 99 others); Tue, 23 Aug 2022 17:53:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbiHWVxU (ORCPT ); Tue, 23 Aug 2022 17:53:20 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EAEA62D3 for ; Tue, 23 Aug 2022 14:53:19 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id x19so11920845pfq.1 for ; Tue, 23 Aug 2022 14:53:19 -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=FnXtIAn0IyAxdQUTX7XZR7kL9caPa6K/jTtIbR9ZQeI=; b=obG8zpTD+VGj/DhquSB91/B1nOh31Mf4zX+mS3y0p5WZzXTnSJmE6BQmTBA4htk1bt XRB+svL4DsVm3OkT5aF7hEmIk/4ALS2HX0O2/ztMnxBw49FnjkWu9FdCfnqi7jQqRU+d 93bGDbVwtR9FlSajQpZw/u8rSYDVTNqP80KtM3yeeIfToDmxuUv9olyyqcQDpDJeWSGi Se31wC8WzlmZeIawaNAM86zcgRAoNetc+63r/+hXDvOEqTgzpIkonR8X/m6Zh4Os6+eX wJIR+cK/L+K6oi+d5tFd8eKuKOA39x2u5gtPHF2/ignKoLU990mH7UniqFXIep+6DPUG I9fw== 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=FnXtIAn0IyAxdQUTX7XZR7kL9caPa6K/jTtIbR9ZQeI=; b=q/fE0dCJnqu/o79PNYJ6ptHiYiyJZhs6iooZ1E8ojtv8p3mdIXH6MYQqmRSJfr4qsR LrT4tIrD2tMe14EoN0Lf8oqdezkErepg91H2nW1cspJkYrcDqw1VUDnvbv2PzXg/e9Sx eJQDJ/u66mSszTuY7L7zRWhJPdu0Eo8PgJ5PDSiugN6OA6HKGNkzJ68kY8pN64M/Twp3 pNft+mN05RPRzl6mhzs+XCj0VBYj/Z0kLY2eNko2Ng3VsrX9ptpvfl8e6znyTFDYwtHj C2kpbPeWeFy4r1ojstsdihaODFYKmp+gWmd4PJQ8IodCcPb/8mcgVhN8Ck471jeffwrj QLfQ== X-Gm-Message-State: ACgBeo2mjqSCNg0rWKaqSN3mRj5tfApmW02ax+oMA0o5DGdNBu6w1zAf ZdawhoXB4XfW41PTc/ZQyEu9ChrA3Drd3wGl X-Received: by 2002:aa7:9e4b:0:b0:536:68f0:dc93 with SMTP id z11-20020aa79e4b000000b0053668f0dc93mr15058614pfq.8.1661291599070; Tue, 23 Aug 2022 14:53:19 -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 f76-20020a62384f000000b0052f20d70845sm11232126pfa.150.2022.08.23.14.53.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 Aug 2022 14:53:18 -0700 (PDT) Message-ID: <95641765-17a4-79aa-1ce3-9cd760ed41f4@flatmax.com> Date: Wed, 24 Aug 2022 07:53:13 +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 looks good. Reviewed-by: Matt Flax 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