realtek: return correct error value for phy ops
[openwrt/staging/jow.git] / target / linux / realtek / files-5.15 / drivers / net / dsa / rtl83xx / rtl838x.c
index c1d6b0c554bc79488bb7ecc58ade545c1e21c561..cbd4543db4c7954ca5f5bdd283c61c8c5ea5595f 100644 (file)
@@ -1832,7 +1832,7 @@ int rtl838x_read_phy(u32 port, u32 page, u32 reg, u32 *val)
 timeout:
        mutex_unlock(&smi_lock);
 
-       return -ETIMEDOUT;
+       return err;
 }
 
 /* Write to a register in a page of the PHY */
@@ -1868,7 +1868,7 @@ int rtl838x_write_phy(u32 port, u32 page, u32 reg, u32 val)
 timeout:
        mutex_unlock(&smi_lock);
 
-       return -ETIMEDOUT;
+       return err;
 }
 
 /* Read an mmd register of a PHY */