Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net-sysfs: remove unused initial ret values

In some net-sysfs functions the ret value is initialized but never used
as it is always overridden. Remove those.

Signed-off-by: Antoine Tenart <atenart@kernel.org>
Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
Link: https://patch.msgid.link/20250226174644.311136-1-atenart@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Antoine Tenart and committed by
Jakub Kicinski
38d41cf5 5a41a00c

+5 -5
+5 -5
net/core/net-sysfs.c
··· 568 568 struct net_device *netdev = to_net_dev(dev); 569 569 struct net *net = dev_net(netdev); 570 570 size_t count = len; 571 - ssize_t ret = 0; 571 + ssize_t ret; 572 572 573 573 if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) 574 574 return -EPERM; ··· 597 597 { 598 598 const struct net_device *netdev = to_net_dev(dev); 599 599 char tmp[IFALIASZ]; 600 - ssize_t ret = 0; 600 + ssize_t ret; 601 601 602 602 ret = dev_get_alias(netdev, tmp, sizeof(tmp)); 603 603 if (ret > 0) ··· 638 638 { 639 639 struct net_device *netdev = to_net_dev(dev); 640 640 struct netdev_phys_item_id ppid; 641 - ssize_t ret = -EINVAL; 641 + ssize_t ret; 642 642 643 643 /* The check is also done in dev_get_phys_port_id; this helps returning 644 644 * early without hitting the locking section below. ··· 664 664 struct device_attribute *attr, char *buf) 665 665 { 666 666 struct net_device *netdev = to_net_dev(dev); 667 - ssize_t ret = -EINVAL; 668 667 char name[IFNAMSIZ]; 668 + ssize_t ret; 669 669 670 670 /* The checks are also done in dev_get_phys_port_name; this helps 671 671 * returning early without hitting the locking section below. ··· 693 693 { 694 694 struct net_device *netdev = to_net_dev(dev); 695 695 struct netdev_phys_item_id ppid = { }; 696 - ssize_t ret = -EINVAL; 696 + ssize_t ret; 697 697 698 698 /* The checks are also done in dev_get_phys_port_name; this helps 699 699 * returning early without hitting the locking section below. This works