From: Vladimir Oltean Date: Thu, 3 Mar 2022 14:01:24 +0000 (+0200) Subject: net: dsa: felix: initialize "err" to 0 in felix_check_xtr_pkt() X-Git-Tag: v5.18-rc1~136^2~194^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dbd032856ba39b6e90d525b7e6340d61a04fcc8f;p=thirdparty%2Flinux.git net: dsa: felix: initialize "err" to 0 in felix_check_xtr_pkt() Automated tools complain that felix_check_xtr_pkt() has logic to drain the CPU queue on the reception of a PTP packet over Ethernet, yet it returns an uninitialized error code in the case where the CPU queue was empty. This is not likely to happen (/possible if hardware works correctly), but it isn't a fatal condition either. The PTP packet will be dequeued from the CPU queue when the next PTP packet arrives. So initialize "err" to 0 for the case where nothing was dequeued during this iteration. Reported-by: kernel test robot Reported-by: Dan Carpenter Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller --- diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 38ce0a487b8fb..e579ade86bfcd 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1469,7 +1469,7 @@ static int felix_hwtstamp_set(struct dsa_switch *ds, int port, static bool felix_check_xtr_pkt(struct ocelot *ocelot) { struct felix *felix = ocelot_to_felix(ocelot); - int err, grp = 0; + int err = 0, grp = 0; if (felix->tag_proto != DSA_TAG_PROTO_OCELOT_8021Q) return false;