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 <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/23204
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Markus Stockhausen
2026-05-05 13:12:17 +02:00
committed by Robert Marko
parent f91c59650e
commit 5e8551e75f
@@ -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)