From 5e8551e75f793a29050948970f72325322abe855 Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Sun, 3 May 2026 18:17:58 +0200 Subject: [PATCH] realtek: mdio: avoid access to uninitialized variable The read functions might fail and thus "val" might be uninitialized. The debug function will output the undefined state. Set the value to zero to be consistent. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/23204 Signed-off-by: Robert Marko --- .../realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c b/target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c index 0e10720b49..dbad948455 100644 --- a/target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c +++ b/target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c @@ -513,7 +513,7 @@ static int rtmdio_931x_write_c45(struct mii_bus *bus, u32 pn, u32 devnum, u32 re static int rtmdio_read_c45(struct mii_bus *bus, int phy, int devnum, int regnum) { struct rtmdio_ctrl *ctrl = rtmdio_ctrl_from_bus(bus); - int ret, val, pn; + int ret, pn, val = 0; pn = rtmdio_phy_to_port(bus, phy); if (pn < 0) @@ -530,7 +530,7 @@ static int rtmdio_read_c45(struct mii_bus *bus, int phy, int devnum, int regnum) static int rtmdio_read_c22(struct mii_bus *bus, int phy, int regnum) { struct rtmdio_ctrl *ctrl = rtmdio_ctrl_from_bus(bus); - int ret, val, pn; + int ret, pn, val = 0; pn = rtmdio_phy_to_port(bus, phy); if (pn < 0)