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-next>] [day] [month] [year] [list]
Message-Id: <1420559120-17405-1-git-send-email-p.zabel@pengutronix.de>
Date:	Tue,  6 Jan 2015 16:45:20 +0100
From:	Philipp Zabel <p.zabel@...gutronix.de>
To:	Mike Turquette <mturquette@...aro.org>,
	Stephen Boyd <sboyd@...eaurora.org>
Cc:	linux-kernel@...r.kernel.org, kernel@...gutronix.de,
	Philipp Zabel <p.zabel@...gutronix.de>
Subject: [PATCH v2] clk: Do not complain about correctly set read-only muxes when assigning clock parents from device tree

Assigning a clock parent to a mux with the CLK_MUX_READ_ONLY flag causes an
error "clk: failed to reparent read_only_mux to already_set_parent: -38"
even if the hardware is already set to the correct parent clock.

This patch avoids the error message by checking whether the correct parent
is already set before calling clk_set_parent. This allows to use the
assigned-clock-parents device tree binding for clock muxes that are not
allowed to be changed anymore at the time of_clk_set_defaults is called.

Signed-off-by: Philipp Zabel <p.zabel@...gutronix.de>
Acked-by: Shawn Guo <shawn.guo@...aro.org>
---
Changes since v1:
 - Added Shawn's ack.
 - Moved the (rc < 0) check into the body of the if statement, directly after
   the rc = clk_set_parent(...) call.
---
 drivers/clk/clk-conf.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk-conf.c b/drivers/clk/clk-conf.c
index aad4796..bb4dc02 100644
--- a/drivers/clk/clk-conf.c
+++ b/drivers/clk/clk-conf.c
@@ -62,10 +62,13 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier)
 			goto err;
 		}
 
-		rc = clk_set_parent(clk, pclk);
-		if (rc < 0)
-			pr_err("clk: failed to reparent %s to %s: %d\n",
-			       __clk_get_name(clk), __clk_get_name(pclk), rc);
+		if (pclk != __clk_get_parent(clk)) {
+			rc = clk_set_parent(clk, pclk);
+			if (rc < 0)
+				pr_err("clk: failed to reparent %s to %s: %d\n",
+				       __clk_get_name(clk),
+				       __clk_get_name(pclk), rc);
+		}
 		clk_put(clk);
 		clk_put(pclk);
 	}
-- 
2.1.4

--
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