Skip to content

Commit 8428011

Browse files
lxingregkh
authored andcommitted
vlan: introduce vlan_dev_free_egress_priority
commit 37aa50c upstream. This patch is to introduce vlan_dev_free_egress_priority() to free egress priority for vlan dev, and keep vlan_dev_uninit() static as .ndo_uninit. It makes the code more clear and safer when adding new code in vlan_dev_uninit() in the future. Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a8604a9 commit 8428011

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

net/8021q/vlan.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ void vlan_dev_set_ingress_priority(const struct net_device *dev,
129129
u32 skb_prio, u16 vlan_prio);
130130
int vlan_dev_set_egress_priority(const struct net_device *dev,
131131
u32 skb_prio, u16 vlan_prio);
132+
void vlan_dev_free_egress_priority(const struct net_device *dev);
132133
int vlan_dev_change_flags(const struct net_device *dev, u32 flag, u32 mask);
133134
void vlan_dev_get_realdev_name(const struct net_device *dev, char *result,
134135
size_t size);
@@ -139,7 +140,6 @@ int vlan_check_real_dev(struct net_device *real_dev,
139140
void vlan_setup(struct net_device *dev);
140141
int register_vlan_dev(struct net_device *dev, struct netlink_ext_ack *extack);
141142
void unregister_vlan_dev(struct net_device *dev, struct list_head *head);
142-
void vlan_dev_uninit(struct net_device *dev);
143143
bool vlan_dev_inherit_address(struct net_device *dev,
144144
struct net_device *real_dev);
145145

net/8021q/vlan_dev.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ static int vlan_dev_init(struct net_device *dev)
622622
}
623623

624624
/* Note: this function might be called multiple times for the same device. */
625-
void vlan_dev_uninit(struct net_device *dev)
625+
void vlan_dev_free_egress_priority(const struct net_device *dev)
626626
{
627627
struct vlan_priority_tci_mapping *pm;
628628
struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
@@ -636,6 +636,11 @@ void vlan_dev_uninit(struct net_device *dev)
636636
}
637637
}
638638

639+
static void vlan_dev_uninit(struct net_device *dev)
640+
{
641+
vlan_dev_free_egress_priority(dev);
642+
}
643+
639644
static netdev_features_t vlan_dev_fix_features(struct net_device *dev,
640645
netdev_features_t features)
641646
{

net/8021q/vlan_netlink.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,11 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev,
183183
return -EINVAL;
184184

185185
err = vlan_changelink(dev, tb, data, extack);
186-
if (!err)
187-
err = register_vlan_dev(dev, extack);
188186
if (err)
189-
vlan_dev_uninit(dev);
187+
return err;
188+
err = register_vlan_dev(dev, extack);
189+
if (err)
190+
vlan_dev_free_egress_priority(dev);
190191
return err;
191192
}
192193

0 commit comments

Comments
 (0)