From patchwork Wed Jul 31 19:12:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13749082 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 D83D5C3DA7F for ; Wed, 31 Jul 2024 19:14:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=cy0HpYKge3In9rMRi0o1G9xiNS//2/gV1bcyWUdIPt0=; b=zaKtNdXe9hfA0d8BnqcT1KAdBG +yhm3jhXxVcFgEk2XMp9tPcUDYgYI/3oy8B5XIupwmJpk27etyUQNvoly5cVA6d7OUqflHumj7SSR aT44v1fSUauZvoPl7TWuKmEnKlT+L/UjgR95OHxWwA7PljZ7DXZW7YmAj1qFx8H1n1PEjJTotROeS p+NifGHhvbfgBEYOqRuvJQ48fqAhjDOxueqEalRKPOsveBWBf1jfUqpBvAWBMlTrtK30yLztTiM60 DzgO0KhrV6DkxEmnIJhr+vtZGeDBobYRBzoxrIomUSgtlT0foa2Fntmer/0aEx/7k3uLeWhQtcmwx hBCzG5bA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZEmQ-00000002EDc-16w7; Wed, 31 Jul 2024 19:14:34 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZElZ-00000002DuF-2olb for linux-arm-kernel@lists.infradead.org; Wed, 31 Jul 2024 19:13:43 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id DA5EFCE17E6; Wed, 31 Jul 2024 19:13:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E252C4AF09; Wed, 31 Jul 2024 19:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722453219; bh=/vCbSfFh+Teb1SyCZnsnZm+zGpfoIjaZBtt5r0JSCrU=; h=From:To:Cc:Subject:Date:From; b=iIZEaUE7CYfFDuICSbjuei0BwDlx9VRivB/9NykOaBEkhcRYStKmUMbDQqdSzH2O9 a6VM4ZwmJnLXbZHc7Q052iIAB7G7pXP85MpcQRLXWeYDKoypf/Obi2EuWbRX4OUkeS 4YFnYSTYUGxqNEaJ6Yf0A0qxmO7FLQs1v5S5bOO7Puixuq3qvIeGByAZm1MGsCyLy6 rc79PB8USLcrWgCAN34og4v4JEtW4b4/6N//eZF2Oxf51MyFdMC+OF9xZ1aAT/YEQx xNIiAtyzbZh4Qa9aS2xI/j+U0+T+3DGe10iYPNiTUNPYIa9RfN76mAesn+rFyW4+dx K1UsAr4sGNXdQ== From: "Rob Herring (Arm)" To: Michael Turquette , Stephen Boyd , Geert Uytterhoeven , Linus Walleij Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] clk: Use of_property_present() Date: Wed, 31 Jul 2024 13:12:42 -0600 Message-ID: <20240731191312.1710417-4-robh@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240731_121341_908861_56142C72 X-CRM114-Status: GOOD ( 13.05 ) 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 Use of_property_present() to test for property presence rather than of_(find|get)_property(). This is part of a larger effort to remove callers of of_find_property() and similar functions. of_(find|get)_property() leak the DT struct property and data pointers which is a problem for dynamically allocated nodes which may be freed. Signed-off-by: Rob Herring (Arm) Reviewed-by: Linus Walleij Reviewed-by: Geert Uytterhoeven Acked-by: Geert Uytterhoeven --- drivers/clk/clk.c | 2 +- drivers/clk/renesas/clk-mstp.c | 2 +- drivers/clk/versatile/clk-sp810.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 285ed1ad8a37..7264cf6165ce 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -5232,7 +5232,7 @@ static int of_parse_clkspec(const struct device_node *np, int index, * clocks. */ np = np->parent; - if (np && !of_get_property(np, "clock-ranges", NULL)) + if (np && !of_property_present(np, "clock-ranges")) break; index = 0; } diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c index 5304c977562f..5bc473c2adb3 100644 --- a/drivers/clk/renesas/clk-mstp.c +++ b/drivers/clk/renesas/clk-mstp.c @@ -207,7 +207,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np) for (i = 0; i < MSTP_MAX_CLOCKS; ++i) clks[i] = ERR_PTR(-ENOENT); - if (of_find_property(np, "clock-indices", &i)) + if (of_property_present(np, "clock-indices")) idxname = "clock-indices"; else idxname = "renesas,clock-indices"; diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c index 45adac1b4630..033d4f78edc8 100644 --- a/drivers/clk/versatile/clk-sp810.c +++ b/drivers/clk/versatile/clk-sp810.c @@ -110,7 +110,7 @@ static void __init clk_sp810_of_setup(struct device_node *node) init.parent_names = parent_names; init.num_parents = num; - deprecated = !of_find_property(node, "assigned-clock-parents", NULL); + deprecated = !of_property_present(node, "assigned-clock-parents"); for (i = 0; i < ARRAY_SIZE(sp810->timerclken); i++) { snprintf(name, sizeof(name), "sp810_%d_%d", instance, i);