Re: [PATCH net-next] net: dsa: motorcomm: Free the MIB block on port teardown

From: Andrew Lunn

Date: Sun Nov 08 2026 - 11:50:53 EST


> @@ -2006,12 +2006,11 @@ static int yt921x_dsa_port_setup(struct dsa_switch *ds, int port)
> struct yt921x_priv *priv = dsa_to_yt921x_priv(ds);
> struct yt921x_port *pp = &priv->ports[port];
> const struct yt921x_info *info = priv->info;
> - struct device *dev = yt921x_priv_to_device(priv);
> struct yt921x_mib *pm = pp->mib;
> int res;
>
> if (!pm && (BIT(port) & yt921x_info_ports_mask(info))) {
> - pm = devm_kzalloc(dev, sizeof(*pm), GFP_KERNEL);
> + pm = kvzalloc_obj(*pm);

Is the if (!pm still needed?

Andrew