Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735058

[PATCH net-next 2/4] net: dsa: setup master ethtool unconditionally

From Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Newsgroups linux.kernel
Subject [PATCH net-next 2/4] net: dsa: setup master ethtool unconditionally
Date 2017-09-19 18:10 +0200
Message-ID <urtfZ-7CA-35@gated-at.bofh.it> (permalink)
References <urtfX-7CA-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When a DSA switch tree is meant to be applied, it already has a CPU
port. Thus remove the condition of dst->cpu_dp.

Moreover, the next lines access dst->cpu_dp unconditionally.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 net/dsa/dsa2.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c
index 873af0108e24..bd19304f862f 100644
--- a/net/dsa/dsa2.c
+++ b/net/dsa/dsa2.c
@@ -433,11 +433,9 @@ static int dsa_dst_apply(struct dsa_switch_tree *dst)
 			return err;
 	}
 
-	if (dst->cpu_dp) {
-		err = dsa_cpu_port_ethtool_setup(dst->cpu_dp);
-		if (err)
-			return err;
-	}
+	err = dsa_cpu_port_ethtool_setup(dst->cpu_dp);
+	if (err)
+		return err;
 
 	/* If we use a tagging format that doesn't have an ethertype
 	 * field, make sure that all packets from this point on get
@@ -474,10 +472,8 @@ static void dsa_dst_unapply(struct dsa_switch_tree *dst)
 		dsa_ds_unapply(dst, ds);
 	}
 
-	if (dst->cpu_dp) {
-		dsa_cpu_port_ethtool_restore(dst->cpu_dp);
-		dst->cpu_dp = NULL;
-	}
+	dsa_cpu_port_ethtool_restore(dst->cpu_dp);
+	dst->cpu_dp = NULL;
 
 	pr_info("DSA: tree %d unapplied\n", dst->tree);
 	dst->applied = false;
-- 
2.14.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 0/4] net: dsa: move master ethtool code Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-09-19 18:10 +0200
  [PATCH net-next 4/4] net: dsa: move master ethtool code Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-09-19 18:10 +0200
    Re: [PATCH net-next 4/4] net: dsa: move master ethtool code Florian Fainelli <f.fainelli@gmail.com> - 2017-09-19 22:00 +0200
  [PATCH net-next 2/4] net: dsa: setup master ethtool unconditionally Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-09-19 18:10 +0200
    Re: [PATCH net-next 2/4] net: dsa: setup master ethtool  unconditionally Florian Fainelli <f.fainelli@gmail.com> - 2017-09-19 19:50 +0200
  Re: [PATCH net-next 0/4] net: dsa: move master ethtool code Florian Fainelli <f.fainelli@gmail.com> - 2017-09-19 22:10 +0200
    Re: [PATCH net-next 0/4] net: dsa: move master ethtool code David Miller <davem@davemloft.net> - 2017-09-20 01:10 +0200

csiph-web