summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGal Pressman <gal@nvidia.com>2024-04-02 16:30:34 +0300
committerJakub Kicinski <kuba@kernel.org>2024-04-03 19:47:58 -0700
commit9ac9299d41f6b67c9b99f1522824572e50a292f8 (patch)
tree4643dcdeec05351a188daab59f46b85adc4b9f13
parente2d515eb8fcdde06da49be981e13f0c7be4f0b16 (diff)
downloadlinux-9ac9299d41f6b67c9b99f1522824572e50a292f8.tar.gz
linux-9ac9299d41f6b67c9b99f1522824572e50a292f8.tar.bz2
linux-9ac9299d41f6b67c9b99f1522824572e50a292f8.zip
net/mlx5e: Use ethtool_sprintf/puts() to fill selftests strings
Use ethtool_sprintf/puts() helper functions which handle the common pattern of printing a string into the ethtool strings interface and incrementing the string pointer by ETH_GSTRING_LEN. The int return value in mlx5e_self_test_fill_strings() is not removed as it is still used to return the number of selftests. Signed-off-by: Gal Pressman <gal@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://lore.kernel.org/r/20240402133043.56322-3-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
index 08a75654f5f1..5bf8318cc48b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c
@@ -359,7 +359,7 @@ int mlx5e_self_test_fill_strings(struct mlx5e_priv *priv, u8 *data)
if (st.cond_func && st.cond_func(priv))
continue;
if (data)
- strcpy(data + count * ETH_GSTRING_LEN, st.name);
+ ethtool_puts(&data, st.name);
count++;
}
return count;