lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1391593680-9388-1-git-send-email-b.brezillon@overkiz.com>
Date:	Wed,  5 Feb 2014 10:48:00 +0100
From:	Boris BREZILLON <b.brezillon@...rkiz.com>
To:	Gregory CLEMENT <gregory.clement@...e-electrons.com>,
	Mike Turquette <mturquette@...aro.org>
Cc:	Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
	Andrew Lunn <andrew@...n.ch>,
	Jason Cooper <jason@...edaemon.net>,
	Ezequiel Garcia <ezequiel.garcia@...e-electrons.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Boris BREZILLON <b.brezillon@...rkiz.com>
Subject: [PATCH] clk: add strict of_clk_init dependency check

The parent dependency check is only available on the first parent of a given
clk.

Add support for strict dependency check: all parents of a given clk must be
initialized.

Signed-off-by: Boris BREZILLON <b.brezillon@...rkiz.com>
---

Hello Gregory,

This patch adds support for strict check on clk dependencies (check if all
parents specified by an DT clk node are initialized).

I'm not sure this is what you were expecting (maybe testing the first parent
is what you really want), so please feel free to tell me if I'm wrong.

Best Regards,

Boris

 drivers/clk/clk.c |   27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index beb0f8b..6849769 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2543,22 +2543,37 @@ static int parent_ready(struct device_node *np)
 {
 	struct of_phandle_args clkspec;
 	struct of_clk_provider *provider;
+	int num_parents;
+	bool found;
+	int i;
 
 	/*
 	 * If there is no clock parent, no need to wait for them, then
 	 * we can consider their absence as being ready
 	 */
-	if (of_parse_phandle_with_args(np, "clocks", "#clock-cells", 0,
-					&clkspec))
+	num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells");
+	if (num_parents <= 0)
 		return 1;
 
-	/* Check if we have such a provider in our array */
-	list_for_each_entry(provider, &of_clk_providers, link) {
-		if (provider->node == clkspec.np)
+	for (i = 0; i < num_parents; i++) {
+		if (of_parse_phandle_with_args(np, "clocks", "#clock-cells", i,
+					       &clkspec))
 			return 1;
+
+		/* Check if we have such a provider in our array */
+		found = false;
+		list_for_each_entry(provider, &of_clk_providers, link) {
+			if (provider->node == clkspec.np) {
+				found = true;
+				break;
+			}
+		}
+
+		if (!found)
+			return 0;
 	}
 
-	return 0;
+	return 1;
 }
 
 /**
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ