diff mbox series

[net-next,v2] net: ethernet: lantiq_etop: remove redundant device name setup

Message ID 20240713170920.863171-1-olek2@wp.pl (mailing list archive)
State Accepted
Commit 9283477e28913c1e7625c0a8d6959745e2431533
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] net: ethernet: lantiq_etop: remove redundant device name setup | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-07-14--09-00 (tests: 696)

Commit Message

Aleksander Jan Bajkowski July 13, 2024, 5:09 p.m. UTC
The same name is set when allocating the netdevice structure in the
alloc_etherdev_mq()->alloc_etherrdev_mqs() function. Therefore, there
is no need to manually set it.

This fixes CheckPatch warnings:
WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
	strcpy(dev->name, "eth%d");

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
---
 drivers/net/ethernet/lantiq_etop.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Andrew Lunn July 13, 2024, 6:02 p.m. UTC | #1
On Sat, Jul 13, 2024 at 07:09:20PM +0200, Aleksander Jan Bajkowski wrote:
> The same name is set when allocating the netdevice structure in the
> alloc_etherdev_mq()->alloc_etherrdev_mqs() function. Therefore, there
> is no need to manually set it.

If this one is not needed:

grep -r "eth%d" *
3com/3c515.c:		sprintf(dev->name, "eth%d", unit);
8390/smc-ultra.c:	sprintf(dev->name, "eth%d", unit);
8390/wd.c:	sprintf(dev->name, "eth%d", unit);
8390/ne.c:	sprintf(dev->name, "eth%d", unit);
amd/lance.c:	sprintf(dev->name, "eth%d", unit);
atheros/atlx/atl2.c:	strcpy(netdev->name, "eth%d"); /* ?? */
cirrus/cs89x0.c:	sprintf(dev->name, "eth%d", unit);
dec/tulip/tulip_core.c:		strcpy(dev->name, "eth%d");			/* un-hack */
intel/ixgbe/ixgbe_main.c:	strcpy(netdev->name, "eth%d");
intel/ixgbevf/ixgbevf_main.c:	strcpy(netdev->name, "eth%d");
intel/e100.c:	strcpy(netdev->name, "eth%d");
intel/igbvf/netdev.c:	strcpy(netdev->name, "eth%d");
intel/e1000e/netdev.c:	strscpy(netdev->name, "eth%d", sizeof(netdev->name));
intel/igb/igb_main.c:	strcpy(netdev->name, "eth%d");
intel/igc/igc_main.c:	strscpy(netdev->name, "eth%d", sizeof(netdev->name));
intel/e1000/e1000_main.c:	strcpy(netdev->name, "eth%d");
lantiq_etop.c:	strcpy(dev->name, "eth%d");
micrel/ks8842.c:	strcpy(netdev->name, "eth%d");
smsc/smc9194.c:		sprintf(dev->name, "eth%d", unit);

maybe you can remove all these as well?

      Andrew
Jakub Kicinski July 15, 2024, 2:03 p.m. UTC | #2
On Sat, 13 Jul 2024 20:02:49 +0200 Andrew Lunn wrote:
> maybe you can remove all these as well?

+1 seems like a good cleanup (after the merge window is over)
patchwork-bot+netdevbpf@kernel.org July 15, 2024, 2:10 p.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sat, 13 Jul 2024 19:09:20 +0200 you wrote:
> The same name is set when allocating the netdevice structure in the
> alloc_etherdev_mq()->alloc_etherrdev_mqs() function. Therefore, there
> is no need to manually set it.
> 
> This fixes CheckPatch warnings:
> WARNING: Prefer strscpy over strcpy - see: https://github.com/KSPP/linux/issues/88
> 	strcpy(dev->name, "eth%d");
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: ethernet: lantiq_etop: remove redundant device name setup
    https://git.kernel.org/netdev/net-next/c/9283477e2891

You are awesome, thank you!
Aleksander Jan Bajkowski July 15, 2024, 4:55 p.m. UTC | #4
On 13.07.2024 20:02, Andrew Lunn wrote:
> On Sat, Jul 13, 2024 at 07:09:20PM +0200, Aleksander Jan Bajkowski wrote:
>> The same name is set when allocating the netdevice structure in the
>> alloc_etherdev_mq()->alloc_etherrdev_mqs() function. Therefore, there
>> is no need to manually set it.
> If this one is not needed:
>
> grep -r "eth%d" *
> 3com/3c515.c:		sprintf(dev->name, "eth%d", unit);
> 8390/smc-ultra.c:	sprintf(dev->name, "eth%d", unit);
> 8390/wd.c:	sprintf(dev->name, "eth%d", unit);
> 8390/ne.c:	sprintf(dev->name, "eth%d", unit);
> amd/lance.c:	sprintf(dev->name, "eth%d", unit);
> atheros/atlx/atl2.c:	strcpy(netdev->name, "eth%d"); /* ?? */
> cirrus/cs89x0.c:	sprintf(dev->name, "eth%d", unit);
> dec/tulip/tulip_core.c:		strcpy(dev->name, "eth%d");			/* un-hack */
> intel/ixgbe/ixgbe_main.c:	strcpy(netdev->name, "eth%d");
> intel/ixgbevf/ixgbevf_main.c:	strcpy(netdev->name, "eth%d");
> intel/e100.c:	strcpy(netdev->name, "eth%d");
> intel/igbvf/netdev.c:	strcpy(netdev->name, "eth%d");
> intel/e1000e/netdev.c:	strscpy(netdev->name, "eth%d", sizeof(netdev->name));
> intel/igb/igb_main.c:	strcpy(netdev->name, "eth%d");
> intel/igc/igc_main.c:	strscpy(netdev->name, "eth%d", sizeof(netdev->name));
> intel/e1000/e1000_main.c:	strcpy(netdev->name, "eth%d");
> lantiq_etop.c:	strcpy(dev->name, "eth%d");
> micrel/ks8842.c:	strcpy(netdev->name, "eth%d");
> smsc/smc9194.c:		sprintf(dev->name, "eth%d", unit);
>
> maybe you can remove all these as well?

Added to my todo list.


>        Andrew
diff mbox series

Patch

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 0b9982804370..9e6984815386 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -675,7 +675,6 @@  ltq_etop_probe(struct platform_device *pdev)
 		err = -ENOMEM;
 		goto err_out;
 	}
-	strcpy(dev->name, "eth%d");
 	dev->netdev_ops = &ltq_eth_netdev_ops;
 	dev->ethtool_ops = &ltq_etop_ethtool_ops;
 	priv = netdev_priv(dev);