提交 c4416f5c 编写于 作者: V Victor Erminpour 提交者: David S. Miller

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: NVictor Erminpour <victor.erminpour@oracle.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9ccc6e0c
......@@ -1607,6 +1607,7 @@ static int mpls_dev_notify(struct notifier_block *this, unsigned long event,
struct net_device *dev = netdev_notifier_info_to_dev(ptr);
struct mpls_dev *mdev;
unsigned int flags;
int err;
if (event == NETDEV_REGISTER) {
mdev = mpls_add_dev(dev);
......@@ -1621,7 +1622,6 @@ static int mpls_dev_notify(struct notifier_block *this, unsigned long event,
return NOTIFY_OK;
switch (event) {
int err;
case NETDEV_DOWN:
err = mpls_ifdown(dev, event);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册