net: dsa: loop: Initialize err in dsa_loop_vlan_dump
authorFlorian Fainelli <f.fainelli@gmail.com>
Wed, 5 Apr 2017 18:19:31 +0000 (11:19 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Apr 2017 20:33:17 +0000 (13:33 -0700)
Dan's static checker reported the following:

drivers/net/dsa/dsa_loop.c:223 dsa_loop_port_vlan_dump()
error: uninitialized symbol 'err'.

which could happen if we do hit the continue statement for each iteration of
the loop. Initialize err to 0 here.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 98cd1552ea27 ("net: dsa: Mock-up driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/dsa_loop.c

index ee55a902fa66ed6367c92af4d1e4e42ae26cf73c..f0fc4de4fc9a4854ac6b2d6926ed549fed71ce26 100644 (file)
@@ -194,7 +194,7 @@ static int dsa_loop_port_vlan_dump(struct dsa_switch *ds, int port,
        struct mii_bus *bus = ps->bus;
        struct dsa_loop_vlan *vl;
        u16 vid, vid_start = 0;
-       int err;
+       int err = 0;
 
        dev_dbg(ds->dev, "%s\n", __func__);