Re: [PATCH net-next v5 4/6] net: dsa: motorcomm: introduce mib_init to control MIB polling initialization
From: Andrew Lunn
Date: Fri Sep 04 2026 - 10:32:24 EST
On Fri, Sep 04, 2026 at 05:54:14PM +0800, Kyle Switch wrote:
> Add a mib_init flag to indicate whether MIB polling has been
> successfully initialized. This prevents the driver from attempting
> to clean up MIB-related resources on removal for switch families
> that do not support MIB polling, which would otherwise trigger
> errors or crashes.
This one i'm not convinced about. At some point, you are going to make
initialisation of MIBs conditional. Why not use that condition to
control removal as well a setup? Why do you need both a conditional
and this pp->mib_init state flag?
> @@ -4771,6 +4772,7 @@ static void yt921x_mdio_remove(struct mdio_device *mdiodev)
> for (size_t i = ARRAY_SIZE(priv->ports); i-- > 0; ) {
> struct yt921x_port *pp = &priv->ports[i];
>
> + if (pp->mib_init)
> disable_delayed_work_sync(&pp->mib_read);
This looks odd. When adding an if (), you would expect the next line
to require an additional indent. Was the indentation already wrong?
Andrew
---
pw-bot: cr