Skip to contentSkip to conversation

net: dsa: print error on invalid port index

PATCH Applied Rafał Miłecki 3 participants 3 messages Jan 6, 2021 – Jan 7, 2021

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

PATCH 1/1 net: dsa: print error on invalid port index

From: Rafał Miłecki <[email protected]>

Looking for an -EINVAL all over the dsa code could take hours for inexperienced DSA users.

---
 net/dsa/dsa2.c | 2 ++
 1 file changed, 2 insertions(+)
net/dsa/dsa2.c +2 -0
index 183003e45762..01f21b0b379a 100644
@@ -783,6 +783,8 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds,
 			goto out_put_node;
 
 		if (reg >= ds->num_ports) {
+			dev_err(ds->dev, "port %pOF index %u exceeds num_ports (%zu)\n",
+				port, reg, ds->num_ports);
 			err = -EINVAL;
 			goto out_put_node;
 		}
Signature · 1 line
2.26.2