netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net-core: remove unnecessary ETHTOOL_GCHANNELS initialization
@ 2020-01-22 22:33 Luigi Rizzo
  2020-01-22 23:47 ` Andrew Lunn
  0 siblings, 1 reply; 7+ messages in thread
From: Luigi Rizzo @ 2020-01-22 22:33 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Michal Kubecek, Luigi Rizzo

struct ethtool_channels does not need .cmd to be set when calling the
driver's ethtool methods. Just zero-initialize it.

Tested: run ethtool -l and ethtool -L
Signed-off-by: Luigi Rizzo <lrizzo@google.com>
---
 net/ethtool/ioctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 182bffbffa78..92442507a57e 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -1555,7 +1555,7 @@ static int ethtool_set_ringparam(struct net_device *dev, void __user *useraddr)
 static noinline_for_stack int ethtool_get_channels(struct net_device *dev,
 						   void __user *useraddr)
 {
-	struct ethtool_channels channels = { .cmd = ETHTOOL_GCHANNELS };
+	struct ethtool_channels channels = {};
 
 	if (!dev->ethtool_ops->get_channels)
 		return -EOPNOTSUPP;
@@ -1570,7 +1570,7 @@ static noinline_for_stack int ethtool_get_channels(struct net_device *dev,
 static noinline_for_stack int ethtool_set_channels(struct net_device *dev,
 						   void __user *useraddr)
 {
-	struct ethtool_channels channels, curr = { .cmd = ETHTOOL_GCHANNELS };
+	struct ethtool_channels channels, curr = {};
 	u16 from_channel, to_channel;
 	u32 max_rx_in_use = 0;
 	unsigned int i;
-- 
2.25.0.341.g760bfbb309-goog


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-01-23 20:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22 22:33 [PATCH] net-core: remove unnecessary ETHTOOL_GCHANNELS initialization Luigi Rizzo
2020-01-22 23:47 ` Andrew Lunn
2020-01-23  0:18   ` Luigi Rizzo
2020-01-23  8:28     ` Michal Kubecek
2020-01-23  8:40     ` Michal Kubecek
2020-01-23 17:47       ` Luigi Rizzo
2020-01-23 20:01         ` Michal Kubecek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).