Skip to contentSkip to conversation

usb: mtu3: Fix device_find_first_child() return value handling

PATCH New Marek Vasut 1 participant 1 message Jul 16, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

---
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
index b1b22b9357c..7eb8360eada 100644
@@ -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