From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0371F8476 for ; Tue, 28 Mar 2023 14:55:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49996C433EF; Tue, 28 Mar 2023 14:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1680015306; bh=86f1pvuyY5a/USY7jbAohKe72v3zX8VEGSpnECTcB30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L8YSY1hOS5H1jIB4NbslolpQWkR3fsGPw7MtlqaV3fuQmYkRbP3SiJ6k9rJPnY9O0 x8/zRvbqBMgT+bfjSiFOQtOAYSDPtn5OS6uZ6oScV+9jLxIl7gnubc9uJyEGVKFKe+ jK++S+UAdo6pAyyxZgOYaEj19w1I9gfCLsa5z6BM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ivan Bornyakov , Fabio Estevam , Shawn Guo Subject: [PATCH 6.2 234/240] bus: imx-weim: fix branch condition evaluates to a garbage value Date: Tue, 28 Mar 2023 16:43:17 +0200 Message-Id: <20230328142629.454423362@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230328142619.643313678@linuxfoundation.org> References: <20230328142619.643313678@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Ivan Bornyakov commit 1adab2922c58e7ff4fa9f0b43695079402cce876 upstream. If bus type is other than imx50_weim_devtype and have no child devices, variable 'ret' in function weim_parse_dt() will not be initialized, but will be used as branch condition and return value. Fix this by initializing 'ret' with 0. This was discovered with help of clang-analyzer, but the situation is quite possible in real life. Fixes: 52c47b63412b ("bus: imx-weim: improve error handling upon child probe-failure") Signed-off-by: Ivan Bornyakov Cc: stable@vger.kernel.org Reviewed-by: Fabio Estevam Signed-off-by: Shawn Guo Signed-off-by: Greg Kroah-Hartman --- drivers/bus/imx-weim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/bus/imx-weim.c +++ b/drivers/bus/imx-weim.c @@ -204,8 +204,8 @@ static int weim_parse_dt(struct platform const struct of_device_id *of_id = of_match_device(weim_id_table, &pdev->dev); const struct imx_weim_devtype *devtype = of_id->data; + int ret = 0, have_child = 0; struct device_node *child; - int ret, have_child = 0; struct weim_priv *priv; void __iomem *base; u32 reg;