Message ID | 20240809044502.4184-1-rosenp@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] net: sunvnet: use ethtool_sprintf/puts | expand |
Hi Rosen, kernel test robot noticed the following build errors: [auto build test ERROR on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Rosen-Penev/net-sunvnet-use-ethtool_sprintf-puts/20240809-145830 base: net-next/main patch link: https://lore.kernel.org/r/20240809044502.4184-1-rosenp%40gmail.com patch subject: [PATCH net-next] net: sunvnet: use ethtool_sprintf/puts config: sparc-allmodconfig (https://download.01.org/0day-ci/archive/20240810/202408100443.OXvAtrM9-lkp@intel.com/config) compiler: sparc64-linux-gcc (GCC) 14.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240810/202408100443.OXvAtrM9-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202408100443.OXvAtrM9-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/net/ethernet/sun/sunvnet.c: In function 'vnet_get_strings': >> drivers/net/ethernet/sun/sunvnet.c:120:36: error: passing argument 2 of 'ethtool_puts' from incompatible pointer type [-Wincompatible-pointer-types] 120 | ethtool_puts(&buf, ðtool_stats_keys); | ^~~~~~~~~~~~~~~~~~~ | | | const struct <anonymous> (*)[14] In file included from drivers/net/ethernet/sun/sunvnet.c:17: include/linux/ethtool.h:1273:49: note: expected 'const char *' but argument is of type 'const struct <anonymous> (*)[14]' 1273 | extern void ethtool_puts(u8 **data, const char *str); | ~~~~~~~~~~~~^~~ vim +/ethtool_puts +120 drivers/net/ethernet/sun/sunvnet.c 112 113 static void vnet_get_strings(struct net_device *dev, u32 stringset, u8 *buf) 114 { 115 struct vnet *vp = (struct vnet *)netdev_priv(dev); 116 struct vnet_port *port; 117 118 switch (stringset) { 119 case ETH_SS_STATS: > 120 ethtool_puts(&buf, ðtool_stats_keys); 121 122 rcu_read_lock(); 123 list_for_each_entry_rcu(port, &vp->port_list, list) { 124 ethtool_sprintf(&buf, "p%u.%s-%pM", port->q_index, 125 port->switch_port ? "s" : "q", 126 port->raddr); 127 ethtool_sprintf(&buf, "p%u.rx_packets", port->q_index); 128 ethtool_sprintf(&buf, "p%u.tx_packets", port->q_index); 129 ethtool_sprintf(&buf, "p%u.rx_bytes", port->q_index); 130 ethtool_sprintf(&buf, "p%u.tx_bytes", port->q_index); 131 ethtool_sprintf(&buf, "p%u.event_up", port->q_index); 132 ethtool_sprintf(&buf, "p%u.event_reset", port->q_index); 133 } 134 rcu_read_unlock(); 135 break; 136 default: 137 WARN_ON(1); 138 break; 139 } 140 } 141
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 2f30715e9b67..f26e76b44c60 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c @@ -114,37 +114,22 @@ static void vnet_get_strings(struct net_device *dev, u32 stringset, u8 *buf) { struct vnet *vp = (struct vnet *)netdev_priv(dev); struct vnet_port *port; - char *p = (char *)buf; switch (stringset) { case ETH_SS_STATS: - memcpy(buf, ðtool_stats_keys, sizeof(ethtool_stats_keys)); - p += sizeof(ethtool_stats_keys); + ethtool_puts(&buf, ðtool_stats_keys); rcu_read_lock(); list_for_each_entry_rcu(port, &vp->port_list, list) { - snprintf(p, ETH_GSTRING_LEN, "p%u.%s-%pM", - port->q_index, port->switch_port ? "s" : "q", - port->raddr); - p += ETH_GSTRING_LEN; - snprintf(p, ETH_GSTRING_LEN, "p%u.rx_packets", - port->q_index); - p += ETH_GSTRING_LEN; - snprintf(p, ETH_GSTRING_LEN, "p%u.tx_packets", - port->q_index); - p += ETH_GSTRING_LEN; - snprintf(p, ETH_GSTRING_LEN, "p%u.rx_bytes", - port->q_index); - p += ETH_GSTRING_LEN; - snprintf(p, ETH_GSTRING_LEN, "p%u.tx_bytes", - port->q_index); - p += ETH_GSTRING_LEN; - snprintf(p, ETH_GSTRING_LEN, "p%u.event_up", - port->q_index); - p += ETH_GSTRING_LEN; - snprintf(p, ETH_GSTRING_LEN, "p%u.event_reset", - port->q_index); - p += ETH_GSTRING_LEN; + ethtool_sprintf(&buf, "p%u.%s-%pM", port->q_index, + port->switch_port ? "s" : "q", + port->raddr); + ethtool_sprintf(&buf, "p%u.rx_packets", port->q_index); + ethtool_sprintf(&buf, "p%u.tx_packets", port->q_index); + ethtool_sprintf(&buf, "p%u.rx_bytes", port->q_index); + ethtool_sprintf(&buf, "p%u.tx_bytes", port->q_index); + ethtool_sprintf(&buf, "p%u.event_up", port->q_index); + ethtool_sprintf(&buf, "p%u.event_reset", port->q_index); } rcu_read_unlock(); break;
Simpler and allows avoiding manual pointer addition. Signed-off-by: Rosen Penev <rosenp@gmail.com> --- drivers/net/ethernet/sun/sunvnet.c | 35 +++++++++--------------------- 1 file changed, 10 insertions(+), 25 deletions(-)