summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorVictor Erminpour <victor.erminpour@oracle.com>2022-02-10 03:28:38 +0300
committerDavid S. Miller <davem@davemloft.net>2022-02-10 18:29:39 +0300
commitc4416f5c2eb3ed48dfba265e628a6e52da962f03 (patch)
tree39018d7e473509138778d0391f2de9bf0890eda9 /net
parent9ccc6e0c8959a019bb40f6b18704b142c04b19a8 (diff)
downloadlinux-c4416f5c2eb3ed48dfba265e628a6e52da962f03.tar.xz
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 <victor.erminpour@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/mpls/af_mpls.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/mpls/af_mpls.c b/net/mpls/af_mpls.c
index 48f75a56f4ae..d6fdc5782d33 100644
--- a/net/mpls/af_mpls.c
+++ b/net/mpls/af_mpls.c
@@ -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);