[PATCH 1/7] clk: Make rfree return void

Simon Glass sjg at chromium.org
Thu Jan 27 16:05:45 CET 2022


Hi Sean,

On Sat, 15 Jan 2022 at 15:25, Sean Anderson <seanga2 at gmail.com> wrote:
>
> When freeing a clock there is not much we can do if there is an error, and
> most callers do not actually check the return value. Even e.g. checking to
> make sure that clk->id is valid should have been done in request() in the
> first place (unless someone is messing with the driver behind our back).
> Just return void and don't bother returning an error.
>
> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
> ---
>
>  drivers/clk/clk-uclass.c  | 7 +++----
>  drivers/clk/clk_sandbox.c | 6 +++---
>  include/clk-uclass.h      | 8 +++-----
>  3 files changed, 9 insertions(+), 12 deletions(-)
>

We have the same thing in other places too, but I am a little worried
about removing error checking. We try to avoid checking arguments too
much in U-Boot, due to code-size concerns, so I suppose I agree that
an invalid clk should be caught by a debug assertion rather than a
full check. But with driver model we have generally added an error
return to every uclass method, for consistency and to permit returning
error information if needed.

Regards,
Simon


More information about the U-Boot mailing list