[PATCH] net: dsa: mv88e6xxx: initialize return variable on declaration
From: Ameer Hamza
Date: Mon Dec 06 2021 - 06:32:57 EST
Uninitialized err variable defined in mv88e6393x_serdes_power
function may cause undefined behaviour if it is called from
mv88e6xxx_serdes_power_down context.
Addresses-Coverity: 1494644 ("Uninitialized scalar variable")
Signed-off-by: Ameer Hamza <amhamza.mgc@xxxxxxxxx>
---
drivers/net/dsa/mv88e6xxx/serdes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c
index 55273013bfb5..33727439724a 100644
--- a/drivers/net/dsa/mv88e6xxx/serdes.c
+++ b/drivers/net/dsa/mv88e6xxx/serdes.c
@@ -1507,7 +1507,7 @@ int mv88e6393x_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane,
bool on)
{
u8 cmode = chip->ports[port].cmode;
- int err;
+ int err = 0;
if (port != 0 && port != 9 && port != 10)
return -EOPNOTSUPP;
--
2.25.1