Hello, On 3/13/20 1:29 PM, Petr Štetiar wrote: > Bjørn Mork <[email protected]> [2020-03-13 09:29:49]: > >> David Bauer <[email protected]> writes: >> >>> --- >>> a/target/linux/ath79/files-4.19/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c >>> +++ >>> b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c >>> @@ -1581,7 +1581,7 @@ static int ag71xx_probe(struct platform_device *pdev) >>> ag->stop_desc->next = (u32) ag->stop_desc_dma; >>> >>> mac_addr = of_get_mac_address(np); >>> - if (mac_addr) >>> + if (mac_addr && !IS_ERR(mac_addr)) >> >> bikeshedding... > > Not bikeshedding at all, good catch. It's an issue which should be fixed. > > It should be just `if (!IS_ERR(mac_addr))` because it's either valid pointer > or ERR_PTR since 5.2 via commit d01f449c008a ("of_net: add NVMEM support to > of_get_mac_address"). I would simply copy&paste the fragment from upstream > ag71xx.c.
And we would need to wrap this statement in precompile conditions depending on the kernel version. I like this idea compared to the current "solution". > 681-NET-add-of_get_mac_address_mtd.patch needs to be updated for 5.4, that > of_get_mac_address_mtd() shouldn't return NULL, but ERR_PTR instead. I'm not quite sure about that. of_get_mac_address is the only caller and all other sub-methods before of_get_mac_addr_nvmem there return NULL in case no valid MAC address can be determined. As long as we are evaluating of_get_mac_address_mtd result prior to the result of of_get_mac_addr_nvmem we should be okay. Best wishes David > > -- ynezz > _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
