[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <s3bkcacl254cqktufnkiynesjbgakvn7abnn426spn6miccrju@5gfkghgchtzy>
Date: Thu, 4 Jan 2024 15:48:19 +0000
From: Alvin Šipraga <ALSI@...g-olufsen.dk>
To: Vladimir Oltean <vladimir.oltean@....com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Andrew Lunn
<andrew@...n.ch>, Florian Fainelli <f.fainelli@...il.com>, Luiz Angelo Daros
de Luca <luizluca@...il.com>, Linus Walleij <linus.walleij@...aro.org>,
Florian Fainelli <florian.fainelli@...adcom.com>, Hauke Mehrtens
<hauke@...ke-m.de>, Christian Marangi <ansuelsmth@...il.com>,
Arınç ÜNAL <arinc.unal@...nc9.com>
Subject: Re: [PATCH net-next 06/10] net: dsa: qca8k: assign ds->user_mii_bus
only for the non-OF case
On Thu, Jan 04, 2024 at 04:00:33PM +0200, Vladimir Oltean wrote:
> To simplify reasoning about why the DSA framework provides the
> ds->user_mii_bus functionality, drivers should only use it if they
> need to. The qca8k driver appears to also use it simply as storage
> for a pointer, which is not a good enough reason to make the core
> much more difficult to follow.
>
> ds->user_mii_bus is useful for only 2 cases:
>
> 1. The driver probes on platform_data (no OF)
> 2. The driver probes on OF, but there is no OF node for the MDIO bus.
>
> It is unclear if case (1) is supported with qca8k. It might not be:
> the driver might crash when of_device_get_match_data() returns NULL
> and then it dereferences priv->info without NULL checking.
>
> Anyway, let us limit the ds->user_mii_bus usage only to the above cases,
> and not assign it when an OF node is present.
>
> The bus->phy_mask assignment follows along with the movement, because
> __of_mdiobus_register() overwrites this bus field anyway. The value set
> by the driver only matters for the non-OF code path.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
Reviewed-by: Alvin Šipraga <alsi@...g-olufsen.dk>
> ---
> drivers/net/dsa/qca/qca8k-8xxx.c | 5 +++--
> drivers/net/dsa/qca/qca8k-leds.c | 4 ++--
> drivers/net/dsa/qca/qca8k.h | 1 +
> 3 files changed, 6 insertions(+), 4 deletions(-)
Powered by blists - more mailing lists