Re: [net-next v16 04/12] net: mtip: The L2 switch driver for imx287

Jakub Kicinski
2025-07-25T22:21:29Z

On Fri, 25 Jul 2025 00:33:10 +0200 Lukasz Majewski wrote:
> + for (i = 0; i < SWITCH_EPORT_NUMBER; i++) {
> + fep->ndev[i] = alloc_netdev(sizeof(struct mtip_ndev_priv),
> + fep->ndev_name[i], NET_NAME_USER,
> + ether_setup);
> + if (!fep->ndev[i]) {
> + ret = -ENOMEM;
> + break;
> + }
> +
> + fep->ndev[i]->ethtool_ops = &mtip_ethtool_ops;
> + fep->ndev[i]->netdev_ops = &mtip_netdev_ops;
> + SET_NETDEV_DEV(fep->ndev[i], &pdev->dev);
> +
> + priv = netdev_priv(fep->ndev[i]);
> + priv->dev = fep->ndev[i];
> + priv->fep = fep;
> + priv->portnum = i + 1;
> + fep->ndev[i]->irq = fep->irq;
> +
> + mtip_setup_mac(fep->ndev[i]);
> +
> + ret = register_netdev(fep->ndev[i]);
> + if (ret) {
> + dev_err(&fep->ndev[i]->dev,
> + "%s: ndev %s register err: %d\n", __func__,
> + fep->ndev[i]->name, ret);
> + break;
> + }

Error handling in case of register_netdev() still buggy, AFAICT.
--
pw-bot: cr