From patchwork Fri Feb 17 13:59:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Bornyakov X-Patchwork-Id: 58660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp953188wrn; Fri, 17 Feb 2023 07:38:54 -0800 (PST) X-Google-Smtp-Source: AK7set+i2YyMnDFRSGOnlr8aSCXRRpnBCK72fMOcSg0ffGH85UGCfmD/YA6FaKWDZE9g6BSDjL2A X-Received: by 2002:a05:6a20:7f8b:b0:c7:1bcf:1dcb with SMTP id d11-20020a056a207f8b00b000c71bcf1dcbmr7976298pzj.25.1676648334023; Fri, 17 Feb 2023 07:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676648334; cv=none; d=google.com; s=arc-20160816; b=AHj2MN17coHg/KGsNAOoopf1svX91ClxLolDBJ0UIG3vOOzqzaHl+IYogh3EfhHk6x hbQ5OdSZEIdfknvoUfRlFwl4iJYWQWeJLPZPX0guwhF7FldfWHNVVbXT8xLW31AN5iup CWWFUk3IPlW0xfi7E2ycaBXVNgZfsn9jhkitQ9wBDgACZeAhKc1P9HKRR+AFMH1l72DY 9161FcfZgAT/J4h7LC4WFrhMMhp0NaKMnbqI/aVa7XhNhpmrHZMx24gn1bdcxy8zcGjA 2nWxT2i0Bnzd4iS5lAc+O8vsiy6TThc5Yxv56/8SLgzjCiMv8s8w0sx4SVuZmDquvBKc uTyg== 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=h4Nd+/5LTa2wWreuwHW//LfS88h2YCPrSyzCMogR8iI=; b=sI1+lU1bJaZkliDNDe86sWBHa6UTHP1gLjyXNDik4BuN0IXql57mWUn4yTjIFLbmK7 RgsBMzkS737RXBW/1ZFmSPblmn6VLa5iQBXuduMmJZFS9EWj9aGSxW6MpAReK6mpWzoH JXNvvxYYn5XMqCpLDRg9WgI8fdZyUBO/t+IMypWRCHcOKqj/RONPCx7AMllIAn6RmvIo Gc05351yvg3FQO3Ju3Hz3PRK9nIMG0csfVn7NhenUq0rN+7T6Rt84rhNpx3nfVn8WjUt 1Z4GPv/ho5EA9JloB/JikR/39bmXeVHLNFQqvrK9+tP8Iw2NCb8pkR38PD1kJO8CoQ1l GfYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@metrotek.ru header.s=mail header.b="R/tER2zM"; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k22-20020a6568d6000000b004fb43b8924asi5017613pgt.395.2023.02.17.07.38.17; Fri, 17 Feb 2023 07:38:53 -0800 (PST) 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=fail header.i=@metrotek.ru header.s=mail header.b="R/tER2zM"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230082AbjBQPbf (ORCPT + 99 others); Fri, 17 Feb 2023 10:31:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbjBQPbe (ORCPT ); Fri, 17 Feb 2023 10:31:34 -0500 X-Greylist: delayed 3623 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 17 Feb 2023 07:31:30 PST Received: from mail.pr-group.ru (mail.pr-group.ru [178.18.215.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EC116F3E7; Fri, 17 Feb 2023 07:31:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=metrotek.ru; s=mail; h=from:subject:date:message-id:to:cc:mime-version:content-transfer-encoding; bh=c/4vBN3nQqBWLIIsDr6bAnmepObZf4pgFEzfOBLDMG0=; b=R/tER2zMUKHtPFfCpbDT3N+K0DGf2KcDXFSKxn6892pcYpCzd6VjpnOYAc1SL+/JZKR3r5TnyAKO8 J+XRZcVeJcfdRu9ylMJSwi2AmmrdERZtXCiBNvHzfpgCt/22lKcupFMCjJYKyjVwXiosC9qJ4tqyrO 9YEVjHl+pPujGfQbKf3wZtqnQGhq5tWM9wmDYikTujayK0sa/quATXYrqySXDCh7zr174S3yOANuRY 14lEzroCsH33HbuVmUQuivEbk0iPoVjcU1UYdgSCx5toFRewBMU6W8uR3QuTaavzw8OJeDJ1o4jnx3 X3d5dmMKfX8jJTBHaIzuw5FKh2keMzw== X-Kerio-Anti-Spam: Build: [Engines: 2.17.1.1470, Stamp: 3], Multi: [Enabled, t: (0.000009,0.008089)], BW: [Enabled, t: (0.000023,0.000001)], RTDA: [Enabled, t: (0.410493), Hit: No, Details: v2.47.0; Id: 15.bhp4c.1gpfqqp4j.2fr; mclb], total: 0(700) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Level: X-Footer: bWV0cm90ZWsucnU= Received: from localhost.localdomain ([78.37.166.219]) (authenticated user i.bornyakov@metrotek.ru) by mail.pr-group.ru with ESMTPSA (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)); Fri, 17 Feb 2023 17:00:41 +0300 From: Ivan Bornyakov To: linux-imx@nxp.com Cc: Ivan Bornyakov , shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH] bus: imx-weim: fix branch condition evaluates to a garbage value Date: Fri, 17 Feb 2023 16:59:50 +0300 Message-Id: <20230217135950.19469-1-i.bornyakov@metrotek.ru> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758093203685367580?= X-GMAIL-MSGID: =?utf-8?q?1758093203685367580?= 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. Signed-off-by: Ivan Bornyakov Cc: stable@vger.kernel.org --- drivers/bus/imx-weim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/imx-weim.c b/drivers/bus/imx-weim.c index 828c66bbaa67..55d917bd1f3f 100644 --- a/drivers/bus/imx-weim.c +++ b/drivers/bus/imx-weim.c @@ -204,8 +204,8 @@ static int weim_parse_dt(struct platform_device *pdev) 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;