[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <68c56bea.050a0220.a9dbf.b7c8@mx.google.com>
Date: Sat, 13 Sep 2025 15:04:40 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Simon Horman <horms@...nel.org>
Cc: Lee Jones <lee@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
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>,
Vladimir Oltean <olteanv@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"Chester A. Unal" <chester.a.unal@...nc9.com>,
Daniel Golle <daniel@...rotopia.org>,
DENG Qingfang <dqfext@...il.com>,
Sean Wang <sean.wang@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [net-next PATCH v17 6/8] mfd: an8855: Add support for Airoha
AN8855 Switch MFD
On Sat, Sep 13, 2025 at 02:01:37PM +0100, Simon Horman wrote:
> On Thu, Sep 11, 2025 at 03:39:21PM +0200, Christian Marangi wrote:
> > Add support for Airoha AN8855 Switch MFD that provide support for a DSA
> > switch and a NVMEM provider.
> >
> > Also make use of the mdio-regmap driver and register a regmap for each
> > internal PHY of the switch.
> > This is needed to handle the double usage of the PHYs as both PHY and
> > Switch accessor.
> >
> > Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
>
> ...
>
> > diff --git a/drivers/mfd/airoha-an8855.c b/drivers/mfd/airoha-an8855.c
>
> ...
>
> > +static int an855_mdio_register(struct device *dev, struct an8855_core_priv *priv)
> > +{
> > + struct device_node *mdio_np;
> > + int ret;
> > +
> > + mdio_np = of_get_child_by_name(dev->of_node, "mdio");
> > + if (!mdio_np)
> > + return -ENODEV;
> > +
> > + for_each_available_child_of_node_scoped(mdio_np, phy_np) {
> > + ret = an8855_phy_register(dev, priv, phy_np);
> > + if (ret)
> > + break;
> > + }
>
> Hi Christian,
>
> Maybe it cannot happen, but if the loop above iterates zero times,
> then ret will be used uninitialised below.
>
> Flagged by Smatch.
>
Do you have hint of how to run smatch on this? Is there a simple arg to
make to enable this?
Anyway yes it goes against schema but it's possible somehow to have a
very broken DT node with no phy in it.
> > +
> > + of_node_put(mdio_np);
> > + return ret;
> > +}
>
> ...
--
Ansuel
Powered by blists - more mailing lists