Re: [PATCH net-next] net: dsa: use ethtool string helpers

From: Kurt Kanzenbach
Date: Tue Oct 22 2024 - 04:29:33 EST


On Mon Oct 21 2024, Rosen Penev wrote:
> These are the preferred way to copy ethtool strings.
>
> Avoids incrementing pointers all over the place.
>
> Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>

[...]

> diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c
> index d798f17cf7ea..283ec5a6e23c 100644
> --- a/drivers/net/dsa/hirschmann/hellcreek.c
> +++ b/drivers/net/dsa/hirschmann/hellcreek.c
> @@ -294,12 +294,8 @@ static void hellcreek_get_strings(struct dsa_switch *ds, int port,
> {
> int i;
>
> - for (i = 0; i < ARRAY_SIZE(hellcreek_counter); ++i) {
> - const struct hellcreek_counter *counter = &hellcreek_counter[i];
> -
> - strscpy(data + i * ETH_GSTRING_LEN,
> - counter->name, ETH_GSTRING_LEN);
> - }
> + for (i = 0; i < ARRAY_SIZE(hellcreek_counter); ++i)
> + ethtool_puts(&data, hellcreek_counter[i].name);
> }

Reviewed-by: Kurt Kanzenbach <kurt@xxxxxxxxxxxxx> # hellcreek

Attachment: signature.asc
Description: PGP signature