Skip to content

Commit c4416f5

Browse files
victor-erminpourdavem330
authored andcommitted
net: mpls: Fix GCC 12 warning
When building with automatic stack variable initialization, GCC 12 complains about variables defined outside of switch case statements. Move the variable outside the switch, which silences the warning: ./net/mpls/af_mpls.c:1624:21: error: statement will never be executed [-Werror=switch-unreachable] 1624 | int err; | ^~~ Signed-off-by: Victor Erminpour <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9ccc6e0 commit c4416f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/mpls/af_mpls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1607,6 +1607,7 @@ static int mpls_dev_notify(struct notifier_block *this, unsigned long event,
16071607
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
16081608
struct mpls_dev *mdev;
16091609
unsigned int flags;
1610+
int err;
16101611

16111612
if (event == NETDEV_REGISTER) {
16121613
mdev = mpls_add_dev(dev);
@@ -1621,7 +1622,6 @@ static int mpls_dev_notify(struct notifier_block *this, unsigned long event,
16211622
return NOTIFY_OK;
16221623

16231624
switch (event) {
1624-
int err;
16251625

16261626
case NETDEV_DOWN:
16271627
err = mpls_ifdown(dev, event);

0 commit comments

Comments
 (0)