summaryrefslogtreecommitdiffstats
path: root/drivers/net/dsa/qca8k.c
diff options
context:
space:
mode:
authorColin Ian King <colin.i.king@gmail.com>2022-02-24 23:05:57 +0100
committerJakub Kicinski <kuba@kernel.org>2022-02-26 07:21:24 +0100
commit38455fbcc8ece5d4bdc0e6f380abd88db0b208e6 (patch)
treea3e26b806c03cefb8d312946f4295b51d51e7eef /drivers/net/dsa/qca8k.c
parentMerge branch 'sja1105-phylink-updates' (diff)
downloadlinux-38455fbcc8ece5d4bdc0e6f380abd88db0b208e6.tar.xz
linux-38455fbcc8ece5d4bdc0e6f380abd88db0b208e6.zip
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: 7544b3ff745b ("net: dsa: qca8k: move pcs configuration") Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20220224220557.147075-1-colin.i.king@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/dsa/qca8k.c')
-rw-r--r--drivers/net/dsa/qca8k.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 6844106975a9..990ed3b07d3c 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -1937,6 +1937,7 @@ static int qca8k_pcs_config(struct phylink_pcs *pcs, unsigned int mode,
default:
WARN_ON(1);
+ return -EINVAL;
}
/* Enable/disable SerDes auto-negotiation as necessary */