net: dsa: realtek: rtl8365mb: fix return value in rtl8365mb_phy_ocp_write
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 net: dsa: realtek: rtl8365mb: fix return value in rtl8365mb_phy_ocp_write
Function rtl8365mb_phy_ocp_write() always returns 0, even when an error occurs during register access. This patch fixes the return value to propagate the actual error code from regmap operations.
---drivers/net/dsa/realtek/rtl8365mb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/realtek/rtl8365mb.c +0 -0
@@ -769,7 +769,7 @@ static int rtl8365mb_phy_ocp_write(struct realtek_priv *priv, int phy,
out:
rtl83xx_unlock(priv);
- return 0;
+ return ret;
}
static int rtl8365mb_phy_read(struct realtek_priv *priv, int phy, int regnum) --
2.43.0
Function rtl8365mb_phy_ocp_write() always returns 0, even when an erroroccurs during register access. This patch fixes the return value to propagate the actual error code from regmap operations.
---drivers/net/dsa/realtek/rtl8365mb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/realtek/rtl8365mb.c +0 -0
drivers/net/dsa/realtek/rtl8365mb.c +0 -0
@@ -769,7 +769,7 @@ static int rtl8365mb_phy_ocp_write(struct realtek_priv *priv, int phy,
out:
rtl83xx_unlock(priv);
- return 0;
+ return ret;
}
static int rtl8365mb_phy_read(struct realtek_priv *priv, int phy, int regnum) --
2.43.0
Andrew Lunn
maintainerQuoted 5 lines · Mietek N
Function
rtl8365mb_phy_ocp_write()always returns 0, even when an erroroccurs during register access. This patch fixes the return value to propagate the actual error code from regmap operations.Fixes 964a56e ("net: dsa: realtek: add RTL8365MB switch driver")Signed-off-by Mieczyslaw Nalewaj <[email protected]>
Please take a read of
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
https://docs.kernel.org/process/submitting-patches.html
Netdev requests that you only submit one version of a patch a day. If you notice something wrong in your patch, reply to it, and say what is wrong. And then post a new version the next day.
This is also v3 of the patch. Please put the version number in the [patch vX] part.
Your hash in the Fixes: is also too short. The kernel requests 12 character hashes. There is a git configuration for this.
Also, 964a56e does not seem correct.
The history is a bit complex. It appears it was first added in
commit 4af2950c50c8634ed2865cf81e607034f78b84aa
Author: Alvin Šipraga <[email protected]> Date: Mon Oct 18 11:38:01 2021 +0200
net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC
which added the file drivers/net/dsa/rtl8365mb.c. That version is correct, it ends with:
+ ret = rtl8365mb_phy_poll_busy(smi);
+ if (ret)
+ return ret;
+
+ return 0;
+}
We have:
commit 319a70a5fea9590e9431dd57f56191996c4787f4
Author: Luiz Angelo Daros de Luca <[email protected]> Date: Fri Jan 28 03:04:58 2022 -0300
net: dsa: realtek-smi: move to subdirectory
and if you look at that version, the return value is still O.K.
What actually seems to break it is:
commit 2796728460b822d549841e0341752b263dc265c4
Author: Alvin Šipraga <[email protected]> Date: Mon Feb 21 19:46:31 2022 +0100
net: dsa: realtek: rtl8365mb: serialize indirect PHY register access
ret = rtl8365mb_phy_poll_busy(priv);
if (ret)
- return ret;
+ goto out;
+
+out:
+ mutex_unlock(&priv->map_lock);
return 0;
}
So instead of directly returning the error code, it now does an unlock, and return 0. So this is what your Fixes tag needs to be.
Andrew
---
pw-bot: cr
[PATCH v4] net: dsa: realtek: rtl8365mb: fix return value in rtl8365mb_phy_ocp_write
Function rtl8365mb_phy_ocp_write() always returns 0, even when an error occurs during register access. This patch fixes the return value to propagate the actual error code from regmap operations.
---drivers/net/dsa/realtek/rtl8365mb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/realtek/rtl8365mb.c +0 -0
drivers/net/dsa/realtek/rtl8365mb.c +0 -0
@@ -769,7 +769,7 @@ static int rtl8365mb_phy_ocp_write(struct realtek_priv *priv, int phy,
out:
rtl83xx_unlock(priv);
- return 0;
+ return ret;
}
static int rtl8365mb_phy_read(struct realtek_priv *priv, int phy, int regnum) --
2.43.0
PATCH v2 1/1 net: dsa: realtek: rtl8365mb: remove ifOutDiscards from rx_packets
In reply to Andrew Lunnrx_packets should report the number of frames successfully received: unicast + multicast + broadcast. Subtracting ifOutDiscards (a TX counter) is incorrect and can undercount RX packets. RX drops are already reported via rx_dropped (e.g. etherStatsDropEvents), so there is no need to adjust rx_packets. This patch removes the subtraction of ifOutDiscards from rx_packets in rtl8365mb_stats_update(). Fixes: 4af2950c50c8634ed2865cf81e607034f78b84aa ("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC") Signed-off-by: Mieczyslaw Nalewaj <[email protected]> --- drivers/net/dsa/realtek/rtl8365mb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/net/dsa/realtek/rtl8365mb.c +++ b/drivers/net/dsa/realtek/rtl8365mb.c @@ -2180,8 +2180,7 @@ static void rtl8365mb_stats_update(struc stats->rx_packets = cnt[RTL8365MB_MIB_ifInUcastPkts] + cnt[RTL8365MB_MIB_ifInMulticastPkts] + - cnt[RTL8365MB_MIB_ifInBroadcastPkts] - - cnt[RTL8365MB_MIB_ifOutDiscards]; + cnt[RTL8365MB_MIB_ifInBroadcastPkts]; stats->tx_packets = cnt[RTL8365MB_MIB_ifOutUcastPkts] + cnt[RTL8365MB_MIB_ifOutMulticastPkts] +
PATCH v3 1/1 net: dsa: realtek: rtl8365mb: remove ifOutDiscards from rx_packets
In reply to Mietek Nrx_packets should report the number of frames successfully received:
unicast + multicast + broadcast. Subtracting ifOutDiscards (a TX counter) is incorrect and can undercount RX packets. RX drops are already reported via rx_dropped (e.g. etherStatsDropEvents), so there is no need to adjust rx_packets.
This patch removes the subtraction of ifOutDiscards from rx_packets in rtl8365mb_stats_update().
("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC")
---
drivers/net/dsa/realtek/rtl8365mb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/dsa/realtek/rtl8365mb.c +0 -0
@@ -2180,8 +2180,7 @@ static void rtl8365mb_stats_update(struc
stats->rx_packets = cnt[RTL8365MB_MIB_ifInUcastPkts] + cnt[RTL8365MB_MIB_ifInMulticastPkts] + - cnt[RTL8365MB_MIB_ifInBroadcastPkts] - - cnt[RTL8365MB_MIB_ifOutDiscards]; + cnt[RTL8365MB_MIB_ifInBroadcastPkts];
stats->tx_packets = cnt[RTL8365MB_MIB_ifOutUcastPkts] + cnt[RTL8365MB_MIB_ifOutMulticastPkts] +
Jakub Kicinski
maintainerRe: [PATCH v3] net: dsa: realtek: rtl8365mb: remove ifOutDiscards from rx_packets
Quoted 10 lines · On Sat, 3 Jan 2026 20:17:49 +0100 Mieczyslaw Nalewaj wrote:
rx_packetsshould report the number of frames successfully received:
unicast + multicast + broadcast. Subtracting ifOutDiscards (a TX counter) is incorrect and can undercount RX packets. RX drops are already reported viarx_dropped(e.g. etherStatsDropEvents), so there is no need to adjustrx_packets.This patch removes the subtraction of ifOutDiscards from
rx_packetsinrtl8365mb_stats_update().Fixes 4af2950c50c8634ed2865cf81e607034f78b84aa
12 characters of the hash in the fixes tag is enough, and don't wrap it.
Quoted 10 lines
("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC")
Signed-off-by Mieczyslaw Nalewaj <[email protected]>--- drivers/net/dsa/realtek/rtl8365mb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/dsa/realtek/rtl8365mb.c static void rtl8365mb_stats_update(struc · line 2186
Quoted 9 lines
drivers/net/dsa/realtek/rtl8365mb.c +1
-2@@ -2180,8 +2180,7 @@ static void rtl8365mb_stats_update(struc stats->rx_packets = cnt[RTL8365MB_MIB_ifInUcastPkts] + cnt[RTL8365MB_MIB_ifInMulticastPkts] + - cnt[RTL8365MB_MIB_ifInBroadcastPkts] - - cnt[RTL8365MB_MIB_ifOutDiscards]; + cnt[RTL8365MB_MIB_ifInBroadcastPkts]; stats->tx_packets = cnt[RTL8365MB_MIB_ifOutUcastPkts] + cnt[RTL8365MB_MIB_ifOutMulticastPkts] +
Patch seems to make sense but it's mangled by your email client. Please try resending with git send-email. Also please have a read of:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html
Signature · 1 line
pw-bot: cr
PATCH v4 1/1 net: dsa: realtek: rtl8365mb: remove ifOutDiscards from rx_packets
rx_packets should report the number of frames successfully received:
unicast + multicast + broadcast. Subtracting ifOutDiscards (a TX counter) is incorrect and can undercount RX packets. RX drops are already reported via rx_dropped (e.g. etherStatsDropEvents), so there is no need to adjust rx_packets.
This patch removes the subtraction of ifOutDiscards from rx_packets in rtl8365mb_stats_update().
--- drivers/net/dsa/realtek/rtl8365mb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/dsa/realtek/rtl8365mb.c +1 -2
@@ -2180,8 +2180,7 @@ static void rtl8365mb_stats_update(struc stats->rx_packets = cnt[RTL8365MB_MIB_ifInUcastPkts] + cnt[RTL8365MB_MIB_ifInMulticastPkts] + - cnt[RTL8365MB_MIB_ifInBroadcastPkts] - - cnt[RTL8365MB_MIB_ifOutDiscards]; + cnt[RTL8365MB_MIB_ifInBroadcastPkts]; stats->tx_packets = cnt[RTL8365MB_MIB_ifOutUcastPkts] + cnt[RTL8365MB_MIB_ifOutMulticastPkts] +
Jakub Kicinski
maintainerRe: [PATCH v4] net: dsa: realtek: rtl8365mb: remove ifOutDiscards from rx_packets
Quoted 4 lines · On Sun, 4 Jan 2026 16:54:53 +0100 Mieczyslaw Nalewaj wrote:
Fixes 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver forRTL8365MB-VC")
Signed-off-by Mieczyslaw Nalewaj <[email protected]>
Still white space damaged.
I asked you to read a document, have you even opened it?
PATCH v5 1/1 net: dsa: realtek: rtl8365mb: remove ifOutDiscards from rx_packets
rx_packets should report the number of frames successfully received:
unicast + multicast + broadcast. Subtracting ifOutDiscards (a TX counter) is incorrect and can undercount RX packets. RX drops are already reported via rx_dropped (e.g. etherStatsDropEvents), so there is no need to adjust rx_packets.
This patch removes the subtraction of ifOutDiscards from rx_packets in rtl8365mb_stats_update().
--- drivers/net/dsa/realtek/rtl8365mb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/dsa/realtek/rtl8365mb.c +1 -2
@@ -2180,8 +2180,7 @@ static void rtl8365mb_stats_update(struc stats->rx_packets = cnt[RTL8365MB_MIB_ifInUcastPkts] + cnt[RTL8365MB_MIB_ifInMulticastPkts] + - cnt[RTL8365MB_MIB_ifInBroadcastPkts] - - cnt[RTL8365MB_MIB_ifOutDiscards]; + cnt[RTL8365MB_MIB_ifInBroadcastPkts]; stats->tx_packets = cnt[RTL8365MB_MIB_ifOutUcastPkts] + cnt[RTL8365MB_MIB_ifOutMulticastPkts] +
Jakub Kicinski
maintainerRe: [PATCH v5] net: dsa: realtek: rtl8365mb: remove ifOutDiscards from rx_packets
Quoted 3 lines · On Sun, 4 Jan 2026 18:39:50 +0100 Mieczyslaw Nalewaj wrote:
Fixes 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC")Signed-off-by Mieczyslaw Nalewaj <[email protected]>
- no empty lines between tags
- don't send patches in reply to existing threads
- don't send new versions less than 24h after previous version
Re: [PATCH v5] net: dsa: realtek: rtl8365mb: remove ifOutDiscards from rx_packets
The fix doesn't add any new lines, it just removes the erroneous one.
Andrew Lunn
maintainerRe: [PATCH v5] net: dsa: realtek: rtl8365mb: remove ifOutDiscards from rx_packets
Quoted 1 line · Mieczyslaw Nalewaj
The fix doesn't add any new lines, it just removes the erroneous one.
Please don't top post.
If you did not top post, and actually looked at the context Jakub included:
Quoted 7 lines
Quoted 3 lines
Fixes 4af2950c50c8 ("net: dsa: realtek-smi: add rtl8365mb subdriver for RTL8365MB-VC")Signed-off-by Mieczyslaw Nalewaj <[email protected]>- no empty lines between tags
- don't send patches in reply to existing threads
- don't send new versions less than 24h after previous version
You will see an empty line. This is one of the reasons we say not to top post. The context is important, it gives you.... context.
Andrew
What else can I do to add this patch?
Andrew Lunn
maintainerQuoted 1 line · Mieczyslaw Nalewaj
What else can I do to add this patch?
I suggest you first get "net: dsa: realtek: rtl8365mb: remove ifOutDiscards from rx_packets" accepted, so that you know you have working email client, and have read the netdev FAQ so don't get anything else wrong.
It takes a while to get processes correct.
Andrew