Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3569907lfo; Mon, 23 May 2022 08:07:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSyF9k8qtH+dmcNPTxriDh/Rd72iHGlUh1zelfoBQjmUNhvewqwPj7K2ZivysYjXxqSaIU X-Received: by 2002:a17:90b:4ac1:b0:1df:c71d:510c with SMTP id mh1-20020a17090b4ac100b001dfc71d510cmr26821429pjb.118.1653318445220; Mon, 23 May 2022 08:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653318445; cv=none; d=google.com; s=arc-20160816; b=QlXAg+7Kc7AyFreI5FEG+TLJ4jNstq2IV5i8bCIft29M/5Q6zsklr1mIbwzPTLQk/+ qR4s+ajEh8NawQp4Y8K3MK3UFHWVSvhL1R0F6a5cUSLgQ8qpd6gmy+FsuZ1x+uY3VHPc OhgcJxwsTHthHlrxRYboGMjBTWttsKBirWKYyAabyPrSbTL/V4SUU1PpbrXujHbFAxgf IAPqM7G1szWvIK93oIQ5C5AkrRl4Mpq5R0uPOcMHWnD30Ov1sOlI1rli1XXgztlunmgM tAeUZa9KUAdkILDqcRUWvY0PIhAOOa/L6SZYccp+fd1mktjOA2BF4KCduPYSjsX2Mbbn S+ag== 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=Gz5O59hkOjTYuw7P+T4Zl/1kNaUomvE6MCJiNMiZQGU=; b=eMw44fdT/SlRR8SGoG+W09SprlD4/SlmFw3CZoDGHFnGqD4uW2uFsm5VJuXgfuOFTO qJN38IdGZFE298r5NSGGP9XGPadDSkaYkVe/0wqHpAavhgFG1j/1m/GxLPaoYj8W6+74 dco/TEYaBiFXTyCIie178Y2w5kA13sIVO0NscAf70NX+F38Uc2lUIow21FVrQE1BIo+u k0smddZmuBnbBY9bsjzA9AKATEcVHbboXrdvipn6/3oWUHoxn3Q1Yt9dLpoLo2Drz5On lFyTId5tGCodo6aKLmWTALGOT6ZIySSMbcP+vZOHd1PXvCW5m+BkTqCkG6Ybxy53gLzQ z4ZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WX8r3XCa; 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 na10-20020a17090b4c0a00b001df6b7a8a90si6552586pjb.72.2022.05.23.08.07.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 08:07:25 -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=WX8r3XCa; 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 8DE344D9E2; Mon, 23 May 2022 08:07:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237628AbiEWPHP (ORCPT + 99 others); Mon, 23 May 2022 11:07:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237603AbiEWPHA (ORCPT ); Mon, 23 May 2022 11:07:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB5F35C351 for ; Mon, 23 May 2022 08:06:58 -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 DE80161259 for ; Mon, 23 May 2022 15:06:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88391C385A9; Mon, 23 May 2022 15:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653318417; bh=qiEZQ8DWEMoinQqoOyjtgxX3eAxznhmWe20hPy5hWDo=; h=From:To:Cc:Subject:Date:From; b=WX8r3XCacUsEACEbsEXvabZzEiI6ikeNhJdubv5QbwatsnStxS7Bwa0mKXtEDMP6l sqS2ZDMZIZey4KB9n2ugYkJg8JoKBOgA0uqb2OnI7ozeZeKXCd7nVfaktwaviaSXet zniWrTycVuR5sB54ZPi5QBiBWwqaRCKdFXXYekAggiRkTCXv3kAhzXRcPnMsQHCld7 4cjiL2Xd+m75YH4bo7l27rCDTJ6M37+giIs7INi6aLEshmUrTEemlal5jiyI3ofWNf s7GLxGivwij3RgDDGh+PO2PUBxP/rqbjjtSnwXfLC804ckIJxt5tlNVdc2WOUu/HTE I/uLpu0Rwii4g== From: Nathan Chancellor To: Arnd Bergmann , Greg Kroah-Hartman Cc: Nick Desaulniers , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Nathan Chancellor , Dan Carpenter , kernel test robot , Tom Rix , Ricky WU Subject: [PATCH] misc: rtsx: Fix clang -Wsometimes-uninitialized in rts5261_init_from_hw() Date: Mon, 23 May 2022 08:05:22 -0700 Message-Id: <20220523150521.2947108-1-nathan@kernel.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.0 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 Clang warns: drivers/misc/cardreader/rts5261.c:406:13: error: variable 'setting_reg2' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] } else if (efuse_valid == 0) { ^~~~~~~~~~~~~~~~ drivers/misc/cardreader/rts5261.c:412:30: note: uninitialized use occurs here pci_read_config_dword(pdev, setting_reg2, &lval2); ^~~~~~~~~~~~ efuse_valid == 1 is not a valid value so just return early from the function to avoid using setting_reg2 uninitialized. Fixes: b1c5f3085149 ("misc: rtsx: add rts5261 efuse function") Reported-by: Dan Carpenter Reported-by: kernel test robot Reported-by: Tom Rix Suggested-by: Ricky WU Signed-off-by: Nathan Chancellor --- This is basically a v2 of https://lore.kernel.org/20220516130047.3887590-1-trix@redhat.com/. drivers/misc/cardreader/rts5261.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/cardreader/rts5261.c b/drivers/misc/cardreader/rts5261.c index 749cc5a46d13..b1e76030cafd 100644 --- a/drivers/misc/cardreader/rts5261.c +++ b/drivers/misc/cardreader/rts5261.c @@ -407,6 +407,8 @@ static void rts5261_init_from_hw(struct rtsx_pcr *pcr) // default setting_reg1 = PCR_SETTING_REG1; setting_reg2 = PCR_SETTING_REG2; + } else { + return; } pci_read_config_dword(pdev, setting_reg2, &lval2); base-commit: 90de6805267f8c79cd2b1a36805071e257c39b5c -- 2.36.1