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 BD7F712A17F; Tue, 23 Jan 2024 00:14:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968855; cv=none; b=e+Itc4Wj2NTtLL9hKYKlIAasVQko2AOjNQ7g5ZFpGo/EPDIkmiIpmTVbQZ6h86rP9tblYsF8O0QGDe2Er882HA2WcuzoCb2O4SP/8tcjgg3rngz1ufe1J5tEH1mT0SDYjaq1yc89WkMGIlAjrs6xadPDzuGjI0Fl9oNGgJiPea0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705968855; c=relaxed/simple; bh=f4FZ8lF4d+yNZLdp6PjtmwEyn1enThQpT6U04YYcXG0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hZzcAlnAPvwHohIiqBQhQhFSMz9s+uj8IQ+B08OapJ/59C1frp3wYaRbonoDxRudMIKK/3Z6WYi7gfZV7IFVG6DnIM4Qa13ssru3DkBScTFvvrbhe7J6hOygwnEMT4bHHAXnUZu1scTpz2fpUmjZU+rGosPdYNHihiJcgcyM9ZI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0Hui/fv4; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="0Hui/fv4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40AD5C433C7; Tue, 23 Jan 2024 00:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1705968855; bh=f4FZ8lF4d+yNZLdp6PjtmwEyn1enThQpT6U04YYcXG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Hui/fv4ItJxUXW6dhT3L+cOwsf+VofRNwKH4EIdyB+fTNT30+v3JEpOGeLLo34n0 i4/+i1yK0Q96q4iZvznNiSh18E3hm493WHX9xhiVwA/uPSG6ee9wgQz+ReGqZkFCjH AL56cFZqAu7r2PXtve6QSvFFQ6E4QYMmrDlbx5Dk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nick Desaulniers , Stefan Wahren , Chen-Yu Tsai , Arnd Bergmann , Sasha Levin Subject: [PATCH 5.4 030/194] ARM: sun9i: smp: fix return code check of of_property_match_string Date: Mon, 22 Jan 2024 15:56:00 -0800 Message-ID: <20240122235720.501005750@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240122235719.206965081@linuxfoundation.org> References: <20240122235719.206965081@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ 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 b2f5f4f28705..f779e386b6e7 100644 --- a/arch/arm/mach-sunxi/mc_smp.c +++ b/arch/arm/mach-sunxi/mc_smp.c @@ -804,12 +804,12 @@ 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; } of_node_put(node); - if (ret) + if (ret < 0) return -ENODEV; is_a83t = sunxi_mc_smp_data[i].is_a83t; -- 2.43.0