WSL2-Linux-Kernel/net/dsa
Vladimir Oltean b94cbc909f net: dsa: fix error code getting shifted with 4 in dsa_slave_get_sset_count
DSA implements a bunch of 'standardized' ethtool statistics counters,
namely tx_packets, tx_bytes, rx_packets, rx_bytes. So whatever the
hardware driver returns in .get_sset_count(), we need to add 4 to that.

That is ok, except that .get_sset_count() can return a negative error
code, for example:

b53_get_sset_count
-> phy_ethtool_get_sset_count
   -> return -EIO

-EIO is -5, and with 4 added to it, it becomes -1, aka -EPERM. One can
imagine that certain error codes may even become positive, although
based on code inspection I did not see instances of that.

Check the error code first, if it is negative return it as-is.

Based on a similar patch for dsa_master_get_strings from Dan Carpenter:
https://patchwork.kernel.org/project/netdevbpf/patch/YJaSe3RPgn7gKxZv@mwanda/

Fixes: 91da11f870 ("net: Distributed Switch Architecture protocol support")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-05-10 14:36:59 -07:00
..
Kconfig net: selftest: fix build issue if INET is disabled 2021-04-28 14:06:45 -07:00
Makefile
dsa.c
dsa2.c net: dsa: Allow default tag protocol to be overridden from DT 2021-04-20 16:51:20 -07:00
dsa_priv.h
master.c net: dsa: fix a crash if ->get_sset_count() fails 2021-05-10 14:31:27 -07:00
port.c net: dsa: fix bridge support for drivers without port_bridge_flags callback 2021-04-21 10:47:27 -07:00
slave.c net: dsa: fix error code getting shifted with 4 in dsa_slave_get_sset_count 2021-05-10 14:36:59 -07:00
switch.c net: dsa: Only notify CPU ports of changes to the tag protocol 2021-04-20 16:51:19 -07:00
tag_8021q.c
tag_ar9331.c
tag_brcm.c
tag_dsa.c
tag_gswip.c
tag_hellcreek.c
tag_ksz.c
tag_lan9303.c
tag_mtk.c
tag_ocelot.c net: mscc: ocelot: support PTP Sync one-step timestamping 2021-04-27 14:10:15 -07:00
tag_ocelot_8021q.c net: mscc: ocelot: support PTP Sync one-step timestamping 2021-04-27 14:10:15 -07:00
tag_qca.c
tag_rtl4_a.c net: dsa: Fix a typo in tag_rtl4_a.c 2021-03-25 17:05:08 -07:00
tag_sja1105.c
tag_trailer.c
tag_xrs700x.c