Skip to content

Commit

Permalink
net: dsa: felix: initialize "err" to 0 in felix_check_xtr_pkt()
Browse files Browse the repository at this point in the history
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 <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vladimir Oltean authored and David S. Miller committed Mar 4, 2022
1 parent d219b4b commit dbd0328
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/dsa/ocelot/felix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dbd0328

Please sign in to comment.