[PATCH v2025.09.y 10/49] clk: clk_set_parent: skip any operation if current and new parents are equal
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Dec 19 01:20:46 PST 2025
From: Michael Grzeschik <m.grzeschik at pengutronix.de>
When an clk is defined with only one parent it probably has no
set_parent function. Therefor changing the parent would return with
-EINVAL. We check for this case and skip this function in this case.
Signed-off-by: Michael Grzeschik <m.grzeschik at pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
Link: https://lore.barebox.org/20251013094943.1299607-1-m.grzeschik@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
(cherry picked from commit c8ad4cc8956f886e50eceeb52fffc38e7ff01d26)
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/clk/clk.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 89a007a12c5b..ac5b83cf8b40 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -302,6 +302,9 @@ int clk_set_parent(struct clk *clk, struct clk *newparent)
if (IS_ERR(newparent))
return PTR_ERR(newparent);
+ if (newparent == curparent)
+ return 0;
+
if (!clk->num_parents)
return -EINVAL;
if (!clk->ops->set_parent)
--
2.47.3
More information about the barebox
mailing list