summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2021-01-06 10:09:15 +0100
committerJakub Kicinski <kuba@kernel.org>2021-01-06 16:21:08 -0800
commit8209f5bc3b67291a4e62ce1a1ce99c53b10e308a (patch)
treed2d0fa2846491c2afe65cd5cd96f7defb9af6d37 /net
parentede71cae72855f8d6f6268510895210adc317666 (diff)
net: dsa: print error on invalid port index
Looking for an -EINVAL all over the dsa code could take hours for inexperienced DSA users. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/20210106090915.21439-1-zajec5@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/dsa/dsa2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 183003e45762..01f21b0b379a 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -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;
}