[PATCH] clk: Dont return error when assigned-clocks is empty or missing

Sean Anderson seanga2 at gmail.com
Tue Jul 11 15:40:50 CEST 2023


On 7/11/23 05:51, Ashok Reddy Soma wrote:
> There is a chance that assigned-clock-rates is given and assigned-clocks
> could be empty. Dont return error in that case, because the probe of the
> corresponding driver will not be called at all if this fails.
> Better to continue to look for it and return 0.

No, this is an error in the device tree. assigned-clock-rates depends on
assigned-clocks, so you must provide the latter if the former is present.

--Sean

> Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma at amd.com>
> ---
> 
>   drivers/clk/clk-uclass.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> index dc3e9d6a26..f186fcbcdb 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -329,7 +329,13 @@ static int clk_set_default_rates(struct udevice *dev,
>   			dev_dbg(dev,
>   				"could not get assigned clock %d (err = %d)\n",
>   				index, ret);
> -			continue;
> +			/* Skip if it is empty */
> +			if (ret == -ENOENT) {
> +				ret = 0;
> +				continue;
> +			}
> +
> +			return ret;
>   		}
>   
>   		/* This is clk provider device trying to program itself



More information about the U-Boot mailing list