[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aW9p9By1ZW5i4iWw@inochi.infowork>
Date: Tue, 20 Jan 2026 19:43:36 +0800
From: Inochi Amaoto <inochiama@...il.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>, Yao Zi <me@...ao.cc>
Cc: Inochi Amaoto <inochiama@...il.com>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, Yixun Lan <dlan@...too.org>,
Maxime Coquelin <mcoquelin.stm32@...il.com>, Alexandre Torgue <alexandre.torgue@...s.st.com>,
Richard Cochran <richardcochran@...il.com>, Paul Walmsley <pjw@...nel.org>,
Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Alexandre Ghiti <alex@...ti.fr>, Yanteng Si <siyanteng@...oftware.com.cn>,
Yao Zi <ziyao@...root.org>, Vladimir Oltean <vladimir.oltean@....com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>, Choong Yong Liang <yong.liang.choong@...ux.intel.com>,
Maxime Chevallier <maxime.chevallier@...tlin.com>, Chen-Yu Tsai <wens@...nel.org>,
Shangjuan Wei <weishangjuan@...incomputing.com>, Boon Khai Ng <boon.khai.ng@...era.com>,
Quentin Schulz <quentin.schulz@...rry.de>, Giuseppe Cavallaro <peppe.cavallaro@...com>,
Jose Abreu <joabreu@...opsys.com>, netdev@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org, spacemit@...ts.linux.dev,
linux-stm32@...md-mailman.stormreply.com, linux-arm-kernel@...ts.infradead.org,
Longbin Li <looong.bin@...il.com>
Subject: Re: [PATCH net-next 3/3] net: stmmac: Add glue layer for Spacemit K3
SoC
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:
> > On Tue, Jan 20, 2026 at 12:36:08PM +0800, Inochi Amaoto wrote:
> > > +static int spacemit_dwmac_probe(struct platform_device *pdev)
> > > +{
> >
> > ...
> >
> > > + 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
Powered by blists - more mailing lists