[PATCH 2/3] net: Expose some errors generated in net_init

Simon Glass sjg at chromium.org
Thu Sep 17 03:09:48 CEST 2020


On Sat, 12 Sep 2020 at 15:46, Sean Anderson <seanga2 at gmail.com> wrote:
>
> net_init does not always succeed, and there is no existing mechanism to
> discover errors. This patch allows callers of net_init (such as net_init)
> to handle errors. The root issue is that eth_get_dev can fail, but
> net_init_loop doesn't expose that. The ideal way to fix eth_get_dev would
> be to return an error with ERR_PTR, but there are a lot of callers, and all
> of them just check if it's NULL. Another approach would be to change the
> signature to something like
>
> int eth_get_dev(struct udevice **pdev)
>
> but that would require rewriting all of the many callers.
>
> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
> ---
>
>  include/net.h    |  2 +-
>  net/eth-uclass.c |  3 +++
>  net/net.c        | 15 +++++++++++----
>  3 files changed, 15 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list