usb: mtu3: Fix device_find_first_child() return value handling
Subsystems (2)
PATCH 1/1 usb: mtu3: Fix device_find_first_child() return value handling
This function only ever returns 0, but may not assign the second parameter. Check the second parameter instead.
Reported-by Jonas Karlman <[email protected]>
Signed-off-by Marek Vasut <[email protected]>
---
Cc: Chunfeng Yun <[email protected]>
Cc: GSS_MTK_Uboot_upstream <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Ryder Lee <[email protected]>
Cc: Weijie Gao <[email protected]>
--- drivers/usb/mtu3/mtu3_plat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/usb/mtu3/mtu3_plat.c +4 -4
@@ -161,10 +161,10 @@ static int get_ssusb_rscs(struct udevice *dev, struct ssusb_mtk *ssusb)return -ENODEV ; } - ret =device_find_first_child (dev, &child); -if (ret || !child) { -dev_err (dev,"failed to get child %d!\n" , ret); -return ret; +device_find_first_child (dev, &child); +if (!child) { +dev_err (dev,"failed to get child!\n" ); +return -ENODEV ; } ssusb->mac_base =devfdt_remap_addr_name (child,"mac" );
Signature · 1 line
2.40.1