[PATCH v2] clk: clk_set_parent: skip any operation if current and new parents are equal
Ahmad Fatoum
a.fatoum at pengutronix.de
Mon Oct 13 03:01:53 PDT 2025
On 10/13/25 11:49 AM, Michael Grzeschik wrote:
> 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>
Thanks,
Ahmad
> ---
> drivers/clk/clk.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 89a007a12c5..ac5b83cf8b4 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)
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list