summaryrefslogtreecommitdiffstats
path: root/net/dsa
diff options
context:
space:
mode:
authorTom Rix <trix@redhat.com>2022-03-05 09:14:48 -0800
committerDavid S. Miller <davem@davemloft.net>2022-03-07 12:25:59 +0000
commitcd5169841c49dab75ecc3b20b3bd1100395b6909 (patch)
treeec55933b9b58a0004ffc993a9325e8686f3be4c0 /net/dsa
parent0273d10182ec4507a43b868dd80fd62860b7e948 (diff)
downloadlinux-cd5169841c49dab75ecc3b20b3bd1100395b6909.tar.bz2
net: dsa: return success if there was nothing to do
Clang static analysis reports this representative issue dsa.c:486:2: warning: Undefined or garbage value returned to caller return err; ^~~~~~~~~~ err is only set in the loop. If the loop is empty, garbage will be returned. So initialize err to 0 to handle this noop case. Signed-off-by: Tom Rix <trix@redhat.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r--net/dsa/dsa.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 06d5de28a43e..fe971a2c15cd 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -471,7 +471,7 @@ int dsa_port_walk_fdbs(struct dsa_switch *ds, int port, dsa_fdb_walk_cb_t cb)
{
struct dsa_port *dp = dsa_to_port(ds, port);
struct dsa_mac_addr *a;
- int err;
+ int err = 0;
mutex_lock(&dp->addr_lists_lock);
@@ -491,7 +491,7 @@ int dsa_port_walk_mdbs(struct dsa_switch *ds, int port, dsa_fdb_walk_cb_t cb)
{
struct dsa_port *dp = dsa_to_port(ds, port);
struct dsa_mac_addr *a;
- int err;
+ int err = 0;
mutex_lock(&dp->addr_lists_lock);