]> git.baikalelectronics.ru Git - uboot.git/commit
net: Expose some errors generated in net_init
authorSean Anderson <seanga2@gmail.com>
Sat, 12 Sep 2020 21:45:43 +0000 (17:45 -0400)
committerTom Rini <trini@konsulko.com>
Sat, 10 Oct 2020 20:50:12 +0000 (16:50 -0400)
commit4b49e0d28a83e046adae0afa66bae85ed12b906a
tree77305ef1b8c3f27d47976e79ca19057f69b00f17
parent867267ade656b7c8fdb27287f896238e8052ac2c
net: Expose some errors generated in net_init

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@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
include/net.h
net/eth-uclass.c
net/net.c