From mboxrd@z Thu Jan 1 00:00:00 1970 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 730DAC3DA6E for ; Mon, 8 Jan 2024 12:29:56 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Wa58kPRMOMnzZjCvDw8or/oTjGj2+5Qqir1zz3e1Kcg=; b=dN0VpV9Au8bmQN JARms4IvgaNaW2DkXi2qX6MjSy4HRJ7MHUUOrptsxu1Z6gZMSoAFiRoy7wGEbCIKI56RpMagG01Xz SkbSs8DO0VXpoRBMcnJko8JJK0vdOEDg6DT8gJbDV1ovSU76RaPYfAIu0uMtofQaMiOEuscvy1Jo7 QICRrgr54h28gXyagvNVt7pI2TuLQyeIZcUBI81LwgsipKbTyuru58Xzu0F6W9eJHrX9BlmXaCob5 BH9Gj6TKYefgUsWHPspOxKcXfHVrK+eFFhe2adhrZAvJXwO8+aXvjpxl4Z8nDX2IHWLWHZyZ8a51y OoMQ+GykMXt6eXC7tXmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rMoky-00536a-2g; Mon, 08 Jan 2024 12:29:28 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rMoku-00533G-1a for linux-arm-kernel@lists.infradead.org; Mon, 08 Jan 2024 12:29:26 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id DFBD1B80D58; Mon, 8 Jan 2024 12:29:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FCABC433CC; Mon, 8 Jan 2024 12:29:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704716962; bh=KIh12wVbDmJiLHjHRse8HnJ7sh45nq/r0+4isSVV99Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VX4+REBemHnabyoaVLGtixeND3gNzgBbFfll7oVLTKVmsUQQw2ogQHRzCCtYMigrD HuNVLRzge8Vp2yhxfs1EKuMQoh+jlmR3AMG3+yF0NCn3Lc+k6hxD3xdMzjnMcUS9J/ RvR3h2SPbx1Yen03Aq1Ujr0KeQRkn2ohvLj+tBS7JoCX4GDlgPa25HdXwgdVo/9sqY DnC0SDhJKHu1ipoGxrzeUT26U77F1/nkCZLuZOTuHSOebozaCL3DIRtgRY2T0KU6S2 YNLZ8LcSTccmu/JqpIBYqWGt3cLxiHXGcXcXWi8OX2jbRuWjt0+ITCVuX6ntLBfCog n4e/itPAKtdag== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stefan Wahren , Nick Desaulniers , Chen-Yu Tsai , Arnd Bergmann , Sasha Levin , linux@armlinux.org.uk, jernej.skrabec@gmail.com, samuel@sholland.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH AUTOSEL 5.4 2/2] ARM: sun9i: smp: fix return code check of of_property_match_string Date: Mon, 8 Jan 2024 07:29:13 -0500 Message-ID: <20240108122915.2090922-2-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240108122915.2090922-1-sashal@kernel.org> References: <20240108122915.2090922-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.4.265 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240108_042924_702493_5CB558E0 X-CRM114-Status: GOOD ( 13.64 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Stefan Wahren [ Upstream commit 643fe70e7bcdcc9e2d96952f7fc2bab56385cce5 ] of_property_match_string returns an int; either an index from 0 or greater if successful or negative on failure. Even it's very unlikely that the DT CPU node contains multiple enable-methods these checks should be fixed. This patch was inspired by the work of Nick Desaulniers. Link: https://lore.kernel.org/lkml/20230516-sunxi-v1-1-ac4b9651a8c1@google.com/T/ Cc: Nick Desaulniers Signed-off-by: Stefan Wahren Link: https://lore.kernel.org/r/20231228193903.9078-2-wahrenst@gmx.net Reviewed-by: Chen-Yu Tsai Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- arch/arm/mach-sunxi/mc_smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-sunxi/mc_smp.c b/arch/arm/mach-sunxi/mc_smp.c index 26cbce1353387..5d7ddfd5990e5 100644 --- a/arch/arm/mach-sunxi/mc_smp.c +++ b/arch/arm/mach-sunxi/mc_smp.c @@ -804,14 +804,14 @@ static int __init sunxi_mc_smp_init(void) for (i = 0; i < ARRAY_SIZE(sunxi_mc_smp_data); i++) { ret = of_property_match_string(node, "enable-method", sunxi_mc_smp_data[i].enable_method); - if (!ret) + if (ret >= 0) break; } is_a83t = sunxi_mc_smp_data[i].is_a83t; of_node_put(node); - if (ret) + if (ret < 0) return -ENODEV; if (!sunxi_mc_smp_cpu_table_init()) -- 2.43.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel