On Sat, Feb 03, 2024 at 07:06:52PM +0100, belouargamoha...@gmail.com wrote: > @@ -1276,6 +1297,30 @@ int __weak macb_late_eth_of_to_plat(struct udevice > *dev) > static int macb_eth_of_to_plat(struct udevice *dev) > { > struct eth_pdata *pdata = dev_get_plat(dev); > + struct macb_device *macb = dev_get_priv(dev); > + void *blob = (void *)gd->fdt_blob; > + int node = dev_of_offset(dev); > + int fl_node, speed_fdt; > + > + /* fetch 'fixed-link' property */ > + fl_node = fdt_subnode_offset(blob, node, "fixed-link"); > + if (fl_node != -FDT_ERR_NOTFOUND) {
Why not check for if (fl_node >= 0)? The fdt_subnode_offset() function can return a variety of error codes. regards, dan carpenter > + /* set phy_addr to invalid value for fixed link */ > + macb->phy_addr = PHY_MAX_ADDR + 1; > + macb->duplex = fdtdec_get_bool(blob, fl_node, "full-duplex"); > + speed_fdt = fdtdec_get_int(blob, fl_node, "speed", 0); > + if (speed_fdt == 100) { > + macb->speed = 1; > + } > + else if (speed_fdt == 10) { > + macb->speed = 0; > + } > + else { > + printf("%s: The given speed %d of ethernet in the DT is > not supported\n", > + __func__, speed_fdt); > + return -EINVAL; > + } > + } >