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.carpen...@oracle.com>
Fixes: 98cd1552ea27 ("net: dsa: Mock-up driver")
Signed-off-by: Florian Fainelli <f.faine...@gmail.com>
---
 drivers/net/dsa/dsa_loop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
index ee55a902fa66..f0fc4de4fc9a 100644
--- a/drivers/net/dsa/dsa_loop.c
+++ b/drivers/net/dsa/dsa_loop.c
@@ -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__);
 
-- 
2.9.3

Reply via email to