Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3792216iob; Tue, 17 May 2022 07:20:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaeoL7mUduELYPpCFY3ZqF+3ME0q4U/7XurbLUUeaGcxr1aLqBk2h0K/qB3l5CqHjti9iQ X-Received: by 2002:a05:6402:1704:b0:42a:c480:dcc8 with SMTP id y4-20020a056402170400b0042ac480dcc8mr4416591edu.59.1652797232679; Tue, 17 May 2022 07:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652797232; cv=none; d=google.com; s=arc-20160816; b=nFQzZxTRlgYW/RZg8iFxT89MYvZg6AyfOeIKSim2vGZhnYxzbxMhUlUngVW6sZA2UU lWroR/RnPfXBPdKv8Z8VSzUnhRElKrZHEwfgRi8D6X7Dsmab8lyYKRWhWCG72fMOZVKt NH3pSG9GvBi0VJo/QWySb49jysjEaig5nlihgGFHRLvRmidu37l+J2+S31QKnXc9Ltbz fekkGDu1fK9pjTpThKUdqsevUCwv2Sk15R9KcFEr1UDiqhZix5nkQqo3av6h9HoWNERO 9NhcAu3+xTm45Rr7mWruLISVqe4+oSQ7HwW5EdhJAkhLRFsREuGywMm45pUcngonbEAD +BVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=0IJeGuY5tYKvN9axhAJnVrgVgRACxJYzXE/eYjk+nos=; b=KjSPlnXwXA94KeDIbZ2vTsU08ryJNp85kubH7Aod2iazMZAEE68shofM7l0N4q7Gav O99lnrdyJSr2X2gbAojuEHWd0Ems9K7kX4/zkOamZrxKkqg4j706V8siVLU0jsxsk0Ra Fl5acyCjnyXCOfQxz+XC56MU6NbChlO/svPRrpgL0a8j2QYkyrJP3xNnucHfCpCc/blM /cK0EGabQwwoQYnWxKdqWz3UELsmYyCo+ARkY1ksmOXYsOjjAksFZVmmjcYMtmvYUW/f mqEgGGdxSVevsDkcBWhwwCMP+BiYoZv8iAyGIgGZx5oKEEAZU/EXZIwcI7i4fgWH/3r/ 8ZyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=IpuQr5fT; 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=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a1709065d0e00b006f52254149bsi3204312ejt.447.2022.05.17.07.20.06; Tue, 17 May 2022 07:20:32 -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=@canonical.com header.s=20210705 header.b=IpuQr5fT; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237548AbiEQBxn (ORCPT + 99 others); Mon, 16 May 2022 21:53:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbiEQBxl (ORCPT ); Mon, 16 May 2022 21:53:41 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30A2439174 for ; Mon, 16 May 2022 18:53:40 -0700 (PDT) Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 6CC1C3FE02 for ; Tue, 17 May 2022 01:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1652752416; bh=0IJeGuY5tYKvN9axhAJnVrgVgRACxJYzXE/eYjk+nos=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=IpuQr5fTBtNkIoXTS+mr+yt8mixkfmYsXfCzGrGINQ8dnGNf5mWrDgsx7BpApLjLS fZQlV6M6PTEgWaTn2IpbqOVGiGqRGwP5RMZLUX0MiJHM0/r3frTfUrsaDDmbNZBOvB KRRhLbBY2Ti1QDCLMSzQVNUTEHC/GUB6zP1ZiTfO+W4tTNgfiwnlHvuZTynvA1BXJ8 NZyOoR61czGm3epwA1jXT7cRtH4Gy29lnuUiDMTO9r+gQs6VJL8E2zalYTH7LAaPWL /0caV6ZR8CofHePsB6bx4Pz6NCe+kHQ2ov4hOg+FhOQaFO9U6oPSX6kFpat4ziqjU7 rUHTGq+ubeldA== Received: by mail-oi1-f199.google.com with SMTP id w205-20020acaadd6000000b0032637f774d0so6034965oie.20 for ; Mon, 16 May 2022 18:53:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0IJeGuY5tYKvN9axhAJnVrgVgRACxJYzXE/eYjk+nos=; b=ScJHclTJL5hoMES0rPKzYYk+sUBNC2OM57bxu4X3Hr61bgcxndEJdy88lFEbj8tolw r+5f8VTC9wdZW2zGAPf8o3EOVTKx1QLFOVPYttWxCBeEifI76eHt4ENrhBL4NERJ+A/w uHgcPhtrjZsbuihF03GMdocF7AO7vb9dQVOs0342PCVPNIsbODzme0aK5HN2BzAGkCO4 hjMA9Z5OLRN2xnWxxRqwhX3Ba4QbeMMI8afqm7f+T0ES5Sy1xBYIv7BsYTl2O/3R0s+D Af9l6h9yKSNwnJ7+QWYzYA0LRQyyY0e5dymkJO+M0nT10K1xGLbK2xAzRM/MkL9ovkSh kqKA== X-Gm-Message-State: AOAM532faCyhGuRhpAJzW+/H4ASNzJ4osTK8I6T+gLMM6Yfskh9Om6y/ EAsrN447637HXtIzQq2txct0nRbWB02y86uhSnrR/LS0WSsmsw4A3Wh589rj87appFaJYY+vnZL /c2eQcZIO0tp0TJEEPTGcpp1QD2T0op5nhHfEEOCIn/o7dk8C8KSf4XQy5w== X-Received: by 2002:a05:6830:33cf:b0:5af:4018:fc2a with SMTP id q15-20020a05683033cf00b005af4018fc2amr7287427ott.161.1652752415162; Mon, 16 May 2022 18:53:35 -0700 (PDT) X-Received: by 2002:a05:6830:33cf:b0:5af:4018:fc2a with SMTP id q15-20020a05683033cf00b005af4018fc2amr7287417ott.161.1652752414886; Mon, 16 May 2022 18:53:34 -0700 (PDT) MIME-Version: 1.0 References: <20220516130047.3887590-1-trix@redhat.com> In-Reply-To: From: Kai-Heng Feng Date: Tue, 17 May 2022 09:53:23 +0800 Message-ID: Subject: Re: [PATCH] misc: rtsx: Set setting_reg2 before use. To: Tom Rix Cc: Nathan Chancellor , arnd@arndb.de, gregkh@linuxfoundation.org, ndesaulniers@google.com, ricky_wu@realtek.com, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 On Tue, May 17, 2022 at 1:06 AM Tom Rix wrote: > > > On 5/16/22 8:56 AM, Nathan Chancellor wrote: > > On Mon, May 16, 2022 at 09:00:47AM -0400, Tom Rix wrote: > >> The clang build fails with > >> rts5261.c:406:13: error: variable 'setting_reg2' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] > >> } else if (efuse_valid == 0) { > >> ^~~~~~~~~~~~~~~~ > >> > >> setting_reg2 is set in this block > >> if (efuse_valid == 2 || efuse_valid == 3) { > >> .. > >> } else if (efuse_valid == 0) { > >> // default > >> .. > >> } > >> But efuse_valid can also have a value of 1. > >> Change the 'else if' to 'else' to make the second block the default. > >> > >> Fixes: b1c5f3085149 ("misc: rtsx: add rts5261 efuse function") > >> Signed-off-by: Tom Rix > > I am not sure if this fix is correct from a functional standpoint (i.e. > > is treating efuse_valid == 1 the same as efuse_valid == 0 correct?) but > > it is better than not handling this value altogether. For what it's > > worth: > > I looked at how the code used to work, this seemed better than > initializing to NULL. Or maybe use a single if block? u16 setting_reg1 =PCR_SETTING_REG1 , setting_reg2 = PCR_SETTING_REG2; ... if ((efuse_valid == 2 || efuse_valid == 3) && (valid != 3) { setting_reg1 = PCR_SETTING_REG4; setting_reg2 = PCR_SETTING_REG5; } Kai-Heng > > > > > Reviewed-by: Nathan Chancellor > > > > As a side note, it is unfortunate that this change made it into -next > > when there was an outstanding report about this warning: > > From the clang side, this is a build break and my static analysis infra > goes down. > > These build breaks seem to happening every week, is there a precommit > clang gating test that could be done for -next ? > > Tom > > > > > https://lore.kernel.org/202205100220.WyAyhKap-lkp@intel.com/ > > > >> --- > >> drivers/misc/cardreader/rts5261.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/drivers/misc/cardreader/rts5261.c b/drivers/misc/cardreader/rts5261.c > >> index 749cc5a46d13..f22634b14dc8 100644 > >> --- a/drivers/misc/cardreader/rts5261.c > >> +++ b/drivers/misc/cardreader/rts5261.c > >> @@ -403,7 +403,7 @@ static void rts5261_init_from_hw(struct rtsx_pcr *pcr) > >> setting_reg1 = PCR_SETTING_REG4; > >> setting_reg2 = PCR_SETTING_REG5; > >> } > >> - } else if (efuse_valid == 0) { > >> + } else { > >> // default > >> setting_reg1 = PCR_SETTING_REG1; > >> setting_reg2 = PCR_SETTING_REG2; > >> -- > >> 2.27.0 > >> > > Cheers, > > Nathan > > >