lan9303: Fix read error execution path
Subsystems (3)
PATCH 1/1 lan9303: Fix read error execution path
This patch fixes an issue where a read failure of a port statistic counter will return unknown results. While it is highly unlikely the read will ever fail, it is much cleaner to return a zero for the stat count.
Fixes a1292595e006 ("net: dsa: add new DSA switch driver for the SMSC-LAN9303")
Signed-off-by Jerry Ray <[email protected]>
--- drivers/net/dsa/lan9303-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/dsa/lan9303-core.c +3 -1
@@ -1005,9 +1005,11 @@ static void lan9303_get_ethtool_stats(struct dsa_switch *ds, int port, ret =lan9303_read_switch_port ( chip, port, lan9303_mib[u].offset, ®); -if (ret) +if (ret) {dev_warn (chip->dev,"Reading status port %d reg %u failed\n" , port, lan9303_mib[u].offset); + reg =0 ; + } data[u] = reg; } }
Signature · 1 line
2.17.1
Vladimir Oltean
maintainerIs it deliberate that you are targeting the "net-next" tree for new features rather than "net" for bug fixes?
Quoted 6 lines · Jerry Ray
This patch fixes an issue where a read failure of a port statistic counter will return unknown results. While it is highly unlikely the read will ever fail, it is much cleaner to return a zero for the stat count.
Fixes a1292595e006 ("net: dsa: add new DSA switch driver for the SMSC-LAN9303")
There shouldn't be blank lines between the tags of a commit, see "git log" for examples.
Not a reason in itself to resend, AFAIK.
Quoted 25 lines
Signed-off-by Jerry Ray <[email protected]>--- drivers/net/dsa/lan9303-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/net/dsa/lan9303-core.c +3
-1@@ -1005,9 +1005,11 @@ static void lan9303_get_ethtool_stats(struct dsa_switch *ds, int port, ret =lan9303_read_switch_port ( chip, port, lan9303_mib[u].offset, ®); -if (ret) +if (ret) {dev_warn (chip->dev,"Reading status port %d reg %u failed\n" , port, lan9303_mib[u].offset); + reg =0 ; + } data[u] = reg; } }Signature · 1 line
2.17.1