From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Fainelli Subject: [PATCH net-next 3/8] net: dsa: Do not check for ethtool_ops validity Date: Wed, 25 Apr 2018 12:12:49 -0700 Message-ID: <20180425191254.3467-4-f.fainelli@gmail.com> References: <20180425191254.3467-1-f.fainelli@gmail.com> Cc: Florian Fainelli , andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, cphealy@gmail.com, davem@davemloft.net, nikita.yoush@cogentembedded.com To: netdev@vger.kernel.org Return-path: Received: from mail-pg0-f67.google.com ([74.125.83.67]:46847 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751445AbeDYTPw (ORCPT ); Wed, 25 Apr 2018 15:15:52 -0400 Received: by mail-pg0-f67.google.com with SMTP id z4so1099268pgu.13 for ; Wed, 25 Apr 2018 12:15:52 -0700 (PDT) In-Reply-To: <20180425191254.3467-1-f.fainelli@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: This is completely redundant with what netdev_set_default_ethtool_ops() does, we are always guaranteed to have a valid dev->ethtool_ops pointer, however, within that structure, not all function calls may be populated, so we still have to check them individually. Signed-off-by: Florian Fainelli --- net/dsa/master.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/dsa/master.c b/net/dsa/master.c index 90e6df0351eb..9ec16b39ed15 100644 --- a/net/dsa/master.c +++ b/net/dsa/master.c @@ -22,7 +22,7 @@ static void dsa_master_get_ethtool_stats(struct net_device *dev, int port = cpu_dp->index; int count = 0; - if (ops && ops->get_sset_count && ops->get_ethtool_stats) { + if (ops->get_sset_count && ops->get_ethtool_stats) { count = ops->get_sset_count(dev, ETH_SS_STATS); ops->get_ethtool_stats(dev, stats, data); } @@ -38,7 +38,7 @@ static int dsa_master_get_sset_count(struct net_device *dev, int sset) struct dsa_switch *ds = cpu_dp->ds; int count = 0; - if (ops && ops->get_sset_count) + if (ops->get_sset_count) count += ops->get_sset_count(dev, sset); if (sset == ETH_SS_STATS && ds->ops->get_sset_count) @@ -64,7 +64,7 @@ static void dsa_master_get_strings(struct net_device *dev, uint32_t stringset, /* We do not want to be NULL-terminated, since this is a prefix */ pfx[sizeof(pfx) - 1] = '_'; - if (ops && ops->get_sset_count && ops->get_strings) { + if (ops->get_sset_count && ops->get_strings) { mcount = ops->get_sset_count(dev, ETH_SS_STATS); ops->get_strings(dev, stringset, data); } -- 2.14.1