usb: ether: Fix error handling in usb_ether_init
authorMichal Suchanek <msuchanek@suse.de>
Wed, 12 Oct 2022 19:57:54 +0000 (21:57 +0200)
committerSimon Glass <sjg@chromium.org>
Tue, 18 Oct 2022 03:17:12 +0000 (21:17 -0600)
commit2cb43ef1c22302820061d4d11ddce85872e993e1
tree2989e9d64589c76404fec6e225a17d99987a8dac
parent28a22cd9a482b947b21646ae595e3284cdea3002
usb: ether: Fix error handling in usb_ether_init

The code checks the return value from uclass_first_device as well as
that the device exists but it passes on the return value which may be
zero if there are no gadget devices. Just check that a device was
returned and return -ENODEV otherwise.

Also remove the dev variable which is not really used for anything.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/usb/gadget/ether.c