From: Michael Grzeschik <[email protected]>

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 <[email protected]>
Reviewed-by: Ahmad Fatoum <[email protected]>
Link: 
https://lore.barebox.org/[email protected]
Signed-off-by: Sascha Hauer <[email protected]>
(cherry picked from commit c8ad4cc8956f886e50eceeb52fffc38e7ff01d26)
Signed-off-by: Ahmad Fatoum <[email protected]>
---
 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


Reply via email to