diff options
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r-- | net/dsa/dsa.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 03c58b0eb082..abadf7b49236 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -124,11 +124,10 @@ int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp) | |||
124 | if (!cpu_ops) | 124 | if (!cpu_ops) |
125 | return -ENOMEM; | 125 | return -ENOMEM; |
126 | 126 | ||
127 | memcpy(&cpu_dp->ethtool_ops, master->ethtool_ops, | ||
128 | sizeof(struct ethtool_ops)); | ||
129 | cpu_dp->orig_ethtool_ops = master->ethtool_ops; | 127 | cpu_dp->orig_ethtool_ops = master->ethtool_ops; |
130 | memcpy(cpu_ops, &cpu_dp->ethtool_ops, | 128 | if (cpu_dp->orig_ethtool_ops) |
131 | sizeof(struct ethtool_ops)); | 129 | memcpy(cpu_ops, cpu_dp->orig_ethtool_ops, sizeof(*cpu_ops)); |
130 | |||
132 | dsa_cpu_port_ethtool_init(cpu_ops); | 131 | dsa_cpu_port_ethtool_init(cpu_ops); |
133 | master->ethtool_ops = cpu_ops; | 132 | master->ethtool_ops = cpu_ops; |
134 | 133 | ||
@@ -138,6 +137,7 @@ int dsa_cpu_port_ethtool_setup(struct dsa_port *cpu_dp) | |||
138 | void dsa_cpu_port_ethtool_restore(struct dsa_port *cpu_dp) | 137 | void dsa_cpu_port_ethtool_restore(struct dsa_port *cpu_dp) |
139 | { | 138 | { |
140 | cpu_dp->netdev->ethtool_ops = cpu_dp->orig_ethtool_ops; | 139 | cpu_dp->netdev->ethtool_ops = cpu_dp->orig_ethtool_ops; |
140 | cpu_dp->orig_ethtool_ops = NULL; | ||
141 | } | 141 | } |
142 | 142 | ||
143 | void dsa_cpu_dsa_destroy(struct dsa_port *port) | 143 | void dsa_cpu_dsa_destroy(struct dsa_port *port) |