On Sun, Feb 19, 2023 at 11:59:36PM -0600, Samuel Holland wrote:
> Do not return both NULL and error pointers. The function is only
> documented as returning error pointers.
> 
> Fixes: 8a1661f20e6c ("drivers: clk: Handle gracefully NULL pointers")
> Signed-off-by: Samuel Holland <sam...@sholland.org>
> ---
> 
>  drivers/clk/clk-uclass.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> index 78299dbceb2..5bce976b060 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -490,7 +490,7 @@ struct clk *clk_get_parent(struct clk *clk)
>  
>       debug("%s(clk=%p)\n", __func__, clk);
>       if (!clk_valid(clk))
> -             return NULL;
> +             return ERR_PTR(-ENODEV);
>  
>       pdev = dev_get_parent(clk->dev);
>       if (!pdev)

Do we really need this?

Who cares about the distinction?

Just returning NULL on any error makes the code so much simpler and
easier to understand.

Thanks

Michal

Reply via email to