From patchwork Thu Oct 12 17:04:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13419485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62520CDB482 for ; Thu, 12 Oct 2023 17:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id:MIME-Version:Subject: Date:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=+bKihysMLmV1maE3NnHydTz6SpKINsccSOQvBHWYbzg=; b=fsF8F2RHZQ86nD lXidwcPhgQSwRpvWLAcuz2uyaan6R5UGSCCsQYhX3tym0AJjNtTrdLnK2OmuiQiF5921coGWUibpY REER32Kdkv1q/QprunGXpELHWInv/moDodEVTIRo8CGzyrV1ixPSM+7WJJQ8wvZAWGOv/oYj8yA2x BIuxVSLdlA0LSwZNZrRgF3dm6orBg6PtmmF+QaioTuiiwnutohKLQnFR5wB5hK1u32eP4tzk6Ejgl p5bIRjVLlF6/Y4uROH07LI+b7hL6a3sCfMUTGY4f6rTBOnnXUdjaJvu2caPujU/sTVQYV10TXuEUa v5A+RCIf8JZd7yiNJbug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qqz6i-001Tmc-1q; Thu, 12 Oct 2023 17:04:20 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qqz6e-001Tlv-0A for linux-arm-kernel@lists.infradead.org; Thu, 12 Oct 2023 17:04:18 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id DF58B61E73; Thu, 12 Oct 2023 17:04:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F4223C433C7; Thu, 12 Oct 2023 17:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697130254; bh=ZbdxYCJsXfSn4QkqlDcEI6V10CuHxqW03BUMi4lw3m0=; h=From:Date:Subject:To:Cc:From; b=SRNW6j7HGGAHmacPEdOqt+JeMG3zGuNbwTV382uqdBmFfS7ikqffSrG+Ydam7u4IY OBSt7vtJvGSuzIaeSJoINXkJsq+BNPyJEng4/kp+HQtvBot3UrflA1wc5CgllJXLEZ p0hUBKYC2NUNrWOiHzzKhfhCsy6CDGD8qksJQAmNS30QOCOK+l9fK1GC+ml9kDOzAd YxhdGP0mDtKnveSL/QkVm9url4IbMD6PuQUTWbzdptUvEpxVTEKMJOgxlv2GJyKPBd qW4K3LLlxAf0Q3w+THt4pc/pH66WI7U4KFU3IcNYNbLR50OimMkP23Hzzc57bnFAcr WdA6hj92AeoGQ== From: Nathan Chancellor Date: Thu, 12 Oct 2023 10:04:01 -0700 Subject: [PATCH] remoteproc: st: Fix sometimes uninitialized ret in st_rproc_probe() MIME-Version: 1.0 Message-Id: <20231012-st_remoteproc-fix-sometimes-uninit-v1-1-f64d0f2d5b37@kernel.org> X-B4-Tracking: v=1; b=H4sIAAAnKGUC/x2NzQqDMBAGX0X23AUTBdFXKaX486XdQxLZTUtBf PcGjwPDzEEGFRhNzUGKr5jkVMHdGlrfc3qBZatMvvWda51nK09FzAW75pWD/NhyRJEI40+SJIW HOQS3bMvQ9SPV0K6o3jW5P87zDy5aRZh0AAAA To: patrice.chotard@foss.st.com, andersson@kernel.org, mathieu.poirier@linaro.org, robh@kernel.org Cc: ndesaulniers@google.com, trix@redhat.com, linux-arm-kernel@lists.infradead.org, linux-remoteproc@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Nathan Chancellor X-Mailer: b4 0.13-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2048; i=nathan@kernel.org; h=from:subject:message-id; bh=ZbdxYCJsXfSn4QkqlDcEI6V10CuHxqW03BUMi4lw3m0=; b=owGbwMvMwCEmm602sfCA1DTG02pJDKka6rzCHx9MkA7/rbR2W+GjN4s5U7vemOWZzCr/ccpOq EHsufbSjlIWBjEOBlkxRZbqx6rHDQ3nnGW8cWoSzBxWJpAhDFycAjCR6gMMf7hv2UY/THn/dv+K L4u/PezbsI31QYY3w6z+S0derXlt7sPKyNCUcbwyLsUybPX6jb/LNPeWSNi+aFR7rPD3ja53+xo xLw4A X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231012_100416_200554_89FEA3AB X-CRM114-Status: GOOD ( 11.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Clang warns (or errors with CONFIG_WERROR=y): drivers/remoteproc/st_remoteproc.c:357:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized] 357 | if (!ddata->config) | ^~~~~~~~~~~~~~ drivers/remoteproc/st_remoteproc.c:442:9: note: uninitialized use occurs here 442 | return ret; | ^~~ drivers/remoteproc/st_remoteproc.c:357:2: note: remove the 'if' if its condition is always false 357 | if (!ddata->config) | ^~~~~~~~~~~~~~~~~~~ 358 | goto free_rproc; | ~~~~~~~~~~~~~~~ drivers/remoteproc/st_remoteproc.c:348:9: note: initialize the variable 'ret' to silence this warning 348 | int ret, i; | ^ | = 0 1 error generated. Set ret to -ENODEV, which seems to be a standard return code when device_get_match_data() returns NULL. Closes: https://github.com/ClangBuiltLinux/linux/issues/1944 Fixes: 5c77ebcd05ac ("remoteproc: st: Use device_get_match_data()") Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers --- drivers/remoteproc/st_remoteproc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- base-commit: 5c77ebcd05acf3789949c8a387df72381d949ca2 change-id: 20231012-st_remoteproc-fix-sometimes-uninit-7aff1bdb7349 Best regards, diff --git a/drivers/remoteproc/st_remoteproc.c b/drivers/remoteproc/st_remoteproc.c index b0638f984842..cb163766c56d 100644 --- a/drivers/remoteproc/st_remoteproc.c +++ b/drivers/remoteproc/st_remoteproc.c @@ -354,8 +354,10 @@ static int st_rproc_probe(struct platform_device *pdev) rproc->has_iommu = false; ddata = rproc->priv; ddata->config = (struct st_rproc_config *)device_get_match_data(dev); - if (!ddata->config) + if (!ddata->config) { + ret = -ENODEV; goto free_rproc; + } platform_set_drvdata(pdev, rproc);