[openwrt/openwrt] realtek: Fix nvmem support for ethernet device

LEDE Commits lede-commits at lists.infradead.org
Thu Aug 28 12:09:16 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/5880f345ba6bf8387a0219aafbce661c1dbca357

commit 5880f345ba6bf8387a0219aafbce661c1dbca357
Author: Harshal Gohel <hg at simonwunderlich.de>
AuthorDate: Mon Apr 14 13:16:47 2025 +0000

    realtek: Fix nvmem support for ethernet device
    
    The function of_get_mac_address is not taking care of evaluation the nvmem
    address before trying to read out the mac-address properties. The driver
    must check whether the return code is -EPROBE_DEFER and stop the probing
    process in that case. If the nvmem-cell related driver code finished, the
    probe can be redone ad the correct mac-address will appear for the device.
    
    Signed-off-by: Harshal Gohel <hg at simonwunderlich.de>
    Signed-off-by: Sharadanand Karanjkar <sk at simonwunderlich.de>
    Link: https://github.com/openwrt/openwrt/pull/19362
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
index 6b856a1b1e..6f90833749 100644
--- a/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
+++ b/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
@@ -3500,7 +3500,10 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
 	 * 1) from device tree data
 	 * 2) from internal registers set by bootloader
 	 */
-	of_get_mac_address(pdev->dev.of_node, mac_addr);
+	err = of_get_mac_address(pdev->dev.of_node, mac_addr);
+	if (err == -EPROBE_DEFER)
+		return err;
+
 	if (is_valid_ether_addr(mac_addr)) {
 		rtl838x_set_mac_hw(dev, mac_addr);
 	} else {




More information about the lede-commits mailing list