On Tue, Jan 20, 2026 at 11:13:50AM +0000, Yao Zi wrote:
On Tue, Jan 20, 2026 at 12:36:08PM +0800, Inochi Amaoto wrote:
quoted
+static int spacemit_dwmac_probe(struct platform_device *pdev)
+{
...
quoted
+ of_property_read_u32(pdev->dev.of_node, "tx-internal-delay-ps", &tx_delay);
+ of_property_read_u32(pdev->dev.of_node, "rx-internal-delay-ps", &rx_delay);
According to of.h, of_property_read_u32, which in turn calls
of_property_read_u32_array, could fail with -ENODATA if there's no value
associated with the property. Should the case be handled?
You cut too much. This had:
unsigned int tx_delay = 0;
unsigned int rx_delay = 0;
at the start of the function.
of_property_read_u32_array() says:
* @out_values: pointer to return value, modified only if return value is 0.
and of_property_read_u32() passes &tx_delay or &rx_delay to this. Thus,
if any error occurs, these will be zero. In other words, a missing
property is equivalent to setting these to zero, which is entirely
reasonable.
However, "unsigned int" _may_ be type equivalent to "u32", but really
these should be "u32" if of_property_read_u32_array() is used.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!