Commit 38455fbc authored by Colin Ian King's avatar Colin Ian King Committed by Jakub Kicinski

net: dsa: qca8k: return with -EINVAL on invalid port

Currently an invalid port throws a WARN_ON warning however invalid
uninitialized values in reg and cpu_port_index are being used later
on. Fix this by returning -EINVAL for an invalid port value.

Addresses clang-scan warnings:
drivers/net/dsa/qca8k.c:1981:3: warning: 2nd function call argument is an
  uninitialized value [core.CallAndMessage]
drivers/net/dsa/qca8k.c:1999:9: warning: 2nd function call argument is an
  uninitialized value [core.CallAndMessage]

Fixes: 7544b3ff ("net: dsa: qca8k: move pcs configuration")
Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220224220557.147075-1-colin.i.king@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 5ebaaa69
...@@ -1937,6 +1937,7 @@ static int qca8k_pcs_config(struct phylink_pcs *pcs, unsigned int mode, ...@@ -1937,6 +1937,7 @@ static int qca8k_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
default: default:
WARN_ON(1); WARN_ON(1);
return -EINVAL;
} }
/* Enable/disable SerDes auto-negotiation as necessary */ /* Enable/disable SerDes auto-negotiation as necessary */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment