]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
ARM: stm32: Perform node compatible check for KS8851 early
authorMarek Vasut <marek.vasut@mailbox.org>
Mon, 15 Sep 2025 00:49:05 +0000 (02:49 +0200)
committerPatrice Chotard <patrice.chotard@foss.st.com>
Tue, 16 Sep 2025 15:36:53 +0000 (17:36 +0200)
Check the compatible string of ethernet1 node for KS8851 very early on,
before calling uclass_get_device_by_of_path() which might initialize
the device and possibly attempt to configure MAC address into device
which is not KS8851. Doing the compatibility check early prevent this.

Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
board/dhelectronics/dh_stm32mp1/board.c

index f7347bbb826ff857c03a9e220d4b6bdc74690b90..bd9326d6b1b30af21d0e9a6e37869b2591a36586 100644 (file)
@@ -85,6 +85,9 @@ static bool dh_stm32_mac_is_in_ks8851(void)
        if (!ofnode_valid(node))
                return false;
 
+       if (!ofnode_device_is_compatible(node, "micrel,ks8851-mll"))
+               return false;
+
        ret = ofnode_get_path(node, path, sizeof(path));
        if (ret)
                return false;
@@ -93,9 +96,6 @@ static bool dh_stm32_mac_is_in_ks8851(void)
        if (ret)
                return false;
 
-       if (!ofnode_device_is_compatible(node, "micrel,ks8851-mll"))
-               return false;
-
        /*
         * KS8851 with EEPROM may use custom MAC from EEPROM, read
         * out the KS8851 CCR register to determine whether EEPROM