[PATCH next] net: dsa: print error on invalid port index
Subsystems:
networking [dsa] , networking [general] , the rest
STALE2049d
LANDED
Landed in mainline as 8209f5bc3b67 on 2021-01-07.
3 messages,
3 authors,
2021-01-07 · open the first message on its own page
From: Rafał Miłecki <rafal@milecki.pl>
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>
---
net/dsa/dsa2.c | 2 ++
1 file changed, 2 insertions(+)
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 ;
} --
2.26.2
On Wed, Jan 06, 2021 at 10:09:15AM +0100, Rafał Miłecki wrote: From: Rafał Miłecki <rafal@milecki.pl>
Looking for an -EINVAL all over the dsa code could take hours for
inexperienced DSA users.
Following this argument, you should add dev_err() by every -EINVAL.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
On Wed, 6 Jan 2021 23:33:07 +0100 Andrew Lunn wrote: On Wed, Jan 06, 2021 at 10:09:15AM +0100, Rafał Miłecki wrote: quoted From: Rafał Miłecki <rafal@milecki.pl>
Looking for an -EINVAL all over the dsa code could take hours for
inexperienced DSA users.
Following this argument, you should add dev_err() by every -EINVAL.
quoted Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Applied, thanks!