Skip to contentSkip to conversation

usb: onboard-hub: Update the bind function based on peer-hub property

PATCH Superseded Venkatesh Yadav Abbarapu 2 participants 2 messages Dec 4, 2024

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 usb: onboard-hub: Update the bind function based on peer-hub property

As the "peer-hub" property is optional, don't error out just skip the bind function.

---
Changes in v2:
- Removed the peer_hub variable and used the return value.

---
 common/usb_onboard_hub.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
common/usb_onboard_hub.c +5 -1
index 6f28036e09..be83f168e1 100644
@@ -183,7 +183,11 @@ static int usb_onboard_hub_bind(struct udevice *dev)
 	int ret, off;
 
 	ret = dev_read_phandle_with_args(dev, "peer-hub", NULL, 0, 0, &phandle);
-	if (ret)  {
+
+	if (ret == -ENOENT) {
+		dev_dbg(dev, "peer-hub property not present\n");
+		return 0;
+	} else if (ret) {
 		dev_err(dev, "peer-hub not specified\n");
 		return ret;
 	}
Signature · 1 line
2.34.1
#1 lore raw

+Patrice

Quoted 16 lines · Venkatesh Yadav Abbarapu

As the "peer-hub" property is optional, don't error out just skip the bind function.

---
Changes in v2:
- Removed the peer_hub variable and used the return value.

---
  common/usb_onboard_hub.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
common/usb_onboard_hub.c +0 -0
index 6f28036e09..be83f168e1 100644

common/usb_onboard_hub.c static int usb_onboard_hub_bind(struct udevice *dev) · line 186

Quoted 5 lines
common/usb_onboard_hub.c +1 -1
@@ -183,7 +183,11 @@ static int usb_onboard_hub_bind(struct udevice *dev)
  	int ret, off;
 
  	ret = dev_read_phandle_with_args(dev, "peer-hub", NULL, 0, 0, &phandle);
-	if (ret)  {
+

no need for this newline.

common/usb_onboard_hub.c static int usb_onboard_hub_bind(struct udevice *dev)

Quoted 4 lines
common/usb_onboard_hub.c +4 -0
+	if (ret == -ENOENT) {
+		dev_dbg(dev, "peer-hub property not present\n");
+		return 0;
+	} else 

This else is not needed. Write it like this.

if (ret == -ENOENT) {
	...
	return 0
}
if (ret) {
	...
	return ret;

}

if (ret) {

common/usb_onboard_hub.c static int usb_onboard_hub_bind(struct udevice *dev) · line 193

Quoted 3 lines
common/usb_onboard_hub.c +0 -0
  		dev_err(dev, "peer-hub not specified\n");
  		return ret;
  	}

Patrice: Can you please try this patch to see if fixes your problem?

Thanks,
Michal