Netdev List
 help / color / mirror / Atom feed
From: Luigi Rizzo <lrizzo@google.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Michal Kubecek <mkubecek@suse.cz>,
	Luigi Rizzo <lrizzo@google.com>
Subject: [PATCH] net-core: remove unnecessary ETHTOOL_GCHANNELS initialization
Date: Wed, 22 Jan 2020 14:33:26 -0800	[thread overview]
Message-ID: <20200122223326.187954-1-lrizzo@google.com> (raw)

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


             reply	other threads:[~2020-01-22 22:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22 22:33 Luigi Rizzo [this message]
2020-01-22 23:47 ` [PATCH] net-core: remove unnecessary ETHTOOL_GCHANNELS initialization 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200122223326.187954-1-lrizzo@google.com \
    --to=lrizzo@google.com \
    --cc=davem@davemloft.net \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox