Thread (22 messages) 22 messages, 5 authors, 2026-01-22

Re: [PATCH net-next 3/3] net: stmmac: Add glue layer for Spacemit K3 SoC

From: Inochi Amaoto <inochiama@gmail.com>
Date: 2026-01-20 11:43:47
Also in: linux-devicetree, linux-riscv, lkml, netdev, spacemit

On Tue, Jan 20, 2026 at 11:28:49AM +0000, Russell King (Oracle) wrote:
On Tue, Jan 20, 2026 at 11:13:50AM +0000, Yao Zi wrote:
quoted
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.
Good catch! I always treat "unsigned int" to "u32" implictly, I will 
change to u32 for as an precise type.

Regards,
Inochi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help