Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1654053ioo; Sun, 22 May 2022 23:09:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbMTmSj2IBRgR2TKQxKTkFj2cuntRIXmQEHL39jIUDBs9fSAk4HOytxuDVzJ6pF/fPGPDC X-Received: by 2002:a17:90a:1f4f:b0:1d8:23d9:de1e with SMTP id y15-20020a17090a1f4f00b001d823d9de1emr24412271pjy.42.1653286158410; Sun, 22 May 2022 23:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653286158; cv=none; d=google.com; s=arc-20160816; b=Y+y2LeWH/LI4Gv1tF8A2J7RV260+/2yfZRsDpel/ML/S8L0OP/wcug3fFVeCe5cJfb HsVlJVn1DJ3S0m+943ix2V484wA7vcq+EOQjobDKQ2vcRJfqtfBs/4zSdC+1ld7oFZES x1PEMka05Dzhthn3inBPgOGVn8x1/CXEOpfvntH+NnRoeVu9C1TgbCch/SlsLGMFwkht w9DrpkUzGJwFmK/jr5JeMNUGUizCJ/UMjq+3GE6B2ofMpYXw4+2yJN46X1ZJrvw+FJvI Kli6rFXGjrePGzWDX3em3sA2Fg7Pva05Bs8P3jPrTxil8JX8qiRRMhANbDbfRXlBz2Z2 SsfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iqFkUJ+Nvf9wx9ylXTzcOPStNKdjNFJKc9KUZlXYFbs=; b=zon8uV5PSOURl943ha0h1+i1bnMSuY27HiLTxPduZC9gT0lDRAmYUKCaNXK4dwXiKg 5HM52Tgd+Joa4pTnVmRnbiPMEfeTedouN5Muxu1/BBgW5zkUuPjLp6G2i6ilahVVWxD6 NZY92F1qULeh7Rga1hNFVcN8zHu6k3U/t3HubR5V5qLtsHnR4zUILOg48q9Drg828HHy tYg1+sBf8R0xu9mYffkjr9SFTzZx2wcuJLAq4LC0hMhf8bZ+J4iD8wnX/TAflVyXnKRm bluoIQmq66sg3IcyYd5wcg8zAhYTVW+3A3hML9EOHAi9m2U+NF8D3TQH83PG6Bv8YCkB ZK+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ILD2JdyT; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k15-20020a6568cf000000b003daee748c98si8902537pgt.661.2022.05.22.23.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 23:09:18 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ILD2JdyT; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3CECE3A5F9; Sun, 22 May 2022 22:59:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244909AbiESU6D (ORCPT + 99 others); Thu, 19 May 2022 16:58:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244382AbiESU57 (ORCPT ); Thu, 19 May 2022 16:57:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0856EC3D2 for ; Thu, 19 May 2022 13:57:57 -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 ams.source.kernel.org (Postfix) with ESMTPS id A6D34B8288F for ; Thu, 19 May 2022 20:57:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBA3BC385AA; Thu, 19 May 2022 20:57:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652993875; bh=x13lgvI1NLwKjefgh/hXMZpz1ml1ACd9zj8zDJhtgss=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ILD2JdyTZXM7ZphRjpyODgeNLgnu8bVwFsXmlbUD0j7AE/lNSxsr7ekXLyVE1PtCC wbhK/59K1EUVkHa1PeUCWWPpQllkNkc8hN9gr5IdYBxwvKPF+vbXyb8rfyAm6uCW/r MTpZo+wXhBfWoB0dyGOD5Vqv+TNYslfbO1evBgnh4yXW6mIgYx7E61rRR3gMk9SW59 qw0BkoEmh/Mdh1fk74cuAp9Kce+StedldvEWVOlQSFBD9tw50CpfEkoc2qrVVTUUcH Ln1yE0+BB6zw0S7C4xiDQKbWjl0K979nQqP60RsQdPaQrOzgDUwXc6W68dGalemoQI 8rmocEXHcASQA== Date: Thu, 19 May 2022 13:57:53 -0700 From: Nathan Chancellor To: Ricky WU Cc: Kai-Heng Feng , Tom Rix , "arnd@arndb.de" , "gregkh@linuxfoundation.org" , "ndesaulniers@google.com" , "linux-kernel@vger.kernel.org" , "llvm@lists.linux.dev" Subject: Re: [PATCH] misc: rtsx: Set setting_reg2 before use. Message-ID: References: <20220516130047.3887590-1-trix@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 08:10:17AM +0000, Ricky WU wrote: > > -----Original Message----- > > From: Kai-Heng Feng > > Sent: Tuesday, May 17, 2022 9:53 AM > > To: Tom Rix > > Cc: Nathan Chancellor ; arnd@arndb.de; > > gregkh@linuxfoundation.org; ndesaulniers@google.com; Ricky WU > > ; linux-kernel@vger.kernel.org; llvm@lists.linux.dev > > Subject: Re: [PATCH] misc: rtsx: Set setting_reg2 before use. > > > > 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; > > Sorry for the trouble > here can be changed to > ... > } else if (efuse_valid == 0) { > // default > setting_reg1 = PCR_SETTING_REG1; > setting_reg2 = PCR_SETTING_REG2; > } else { > return; > } > Because other values are invalid Tom, were you going to send a v2 of this? Cheers, Nathan