diff mbox series

net: dsa: b53: check for timeout

Message ID 20200821135600.18017-1-trix@redhat.com
State Accepted
Delegated to: David Miller
Headers show
Series net: dsa: b53: check for timeout | expand

Commit Message

Tom Rix Aug. 21, 2020, 1:56 p.m. UTC
From: Tom Rix <trix@redhat.com>

clang static analysis reports this problem

b53_common.c:1583:13: warning: The left expression of the compound
  assignment is an uninitialized value. The computed value will
  also be garbage
        ent.port &= ~BIT(port);
        ~~~~~~~~ ^

ent is set by a successful call to b53_arl_read().  Unsuccessful
calls are caught by an switch statement handling specific returns.
b32_arl_read() calls b53_arl_op_wait() which fails with the
unhandled -ETIMEDOUT.

So add -ETIMEDOUT to the switch statement.  Because
b53_arl_op_wait() already prints out a message, do not add another
one.

Fixes: 1da6df85c6fb ("net: dsa: b53: Implement ARL add/del/dump operations")

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/dsa/b53/b53_common.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Florian Fainelli Aug. 21, 2020, 2:43 p.m. UTC | #1
On 8/21/2020 6:56 AM, trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
> 
> clang static analysis reports this problem
> 
> b53_common.c:1583:13: warning: The left expression of the compound
>    assignment is an uninitialized value. The computed value will
>    also be garbage
>          ent.port &= ~BIT(port);
>          ~~~~~~~~ ^
> 
> ent is set by a successful call to b53_arl_read().  Unsuccessful
> calls are caught by an switch statement handling specific returns.
> b32_arl_read() calls b53_arl_op_wait() which fails with the
> unhandled -ETIMEDOUT.
> 
> So add -ETIMEDOUT to the switch statement.  Because
> b53_arl_op_wait() already prints out a message, do not add another
> one.
> 
> Fixes: 1da6df85c6fb ("net: dsa: b53: Implement ARL add/del/dump operations")

For future submissions: no need for a newline between your tags here, 
the Fixes tag is just a regular tag in the commit message.

> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>
David Miller Aug. 21, 2020, 6:48 p.m. UTC | #2
From: trix@redhat.com
Date: Fri, 21 Aug 2020 06:56:00 -0700

> From: Tom Rix <trix@redhat.com>
> 
> clang static analysis reports this problem
> 
> b53_common.c:1583:13: warning: The left expression of the compound
>   assignment is an uninitialized value. The computed value will
>   also be garbage
>         ent.port &= ~BIT(port);
>         ~~~~~~~~ ^
> 
> ent is set by a successful call to b53_arl_read().  Unsuccessful
> calls are caught by an switch statement handling specific returns.
> b32_arl_read() calls b53_arl_op_wait() which fails with the
> unhandled -ETIMEDOUT.
> 
> So add -ETIMEDOUT to the switch statement.  Because
> b53_arl_op_wait() already prints out a message, do not add another
> one.
> 
> Fixes: 1da6df85c6fb ("net: dsa: b53: Implement ARL add/del/dump operations")
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Applied and queued up for -stable, thanks.
diff mbox series

Patch

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index abe0a3e20648..e731db900ee0 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -1554,6 +1554,8 @@  static int b53_arl_op(struct b53_device *dev, int op, int port,
 		return ret;
 
 	switch (ret) {
+	case -ETIMEDOUT:
+		return ret;
 	case -ENOSPC:
 		dev_dbg(dev->dev, "{%pM,%.4d} no space left in ARL\n",
 			addr, vid);