Re: [PATCH net-next v8 2/3] net: ti: icssm-prueth: Add switchdev support for icssm_prueth driver

Jakub Kicinski
2025-12-01T22:16:40Z

On Wed, 26 Nov 2025 21:57:13 +0530 Parvathi Pudi wrote:
> + */
> +static void icssm_prueth_sw_switchdev_event_work(struct work_struct *work)
> +{
> + struct icssm_prueth_sw_switchdev_event_work *switchdev_work =
> + container_of(work,
> + struct icssm_prueth_sw_switchdev_event_work, work);

Consider using shorter type names.

> + struct prueth_emac *emac = switchdev_work->emac;
> + struct switchdev_notifier_fdb_info *fdb;
> + struct prueth *prueth = emac->prueth;
> + int port = emac->port_id;
> +
> + rtnl_lock();
> +
> + /* Interface is not up */
> + if (!emac->prueth->fdb_tbl) {
> + rtnl_unlock();

Are you not leaking the device reference here?

> + return;
> + }
> +
> + switch (switchdev_work->event) {
> + case SWITCHDEV_FDB_ADD_TO_DEVICE:
> + fdb = &switchdev_work->fdb_info;
> + dev_dbg(prueth->dev,
> + "prueth fdb add: MACID = %pM vid = %u flags = %u -- port %d\n",
> + fdb->addr, fdb->vid, fdb->added_by_user, port);
> +
> + if (!fdb->added_by_user)
> + break;
> +
> + if (fdb->is_local)
> + break;
> +
> + icssm_prueth_sw_fdb_add(emac, fdb);
> + icssm_prueth_sw_fdb_offload_notify(emac->ndev, fdb);
> + break;
> + case SWITCHDEV_FDB_DEL_TO_DEVICE:
> + fdb = &switchdev_work->fdb_info;
> + dev_dbg(prueth->dev,
> + "prueth fdb del: MACID = %pM vid = %u flags = %u -- port %d\n",
> + fdb->addr, fdb->vid, fdb->added_by_user, port);
> +
> + if (fdb->is_local)
> + break;
> +
> + icssm_prueth_sw_fdb_del(emac, fdb);
> + break;
> + default:
> + break;
> + }
> + rtnl_unlock();
> +
> + netdev_put(emac->ndev, &switchdev_work->ndev_tracker);
> + kfree(switchdev_work->fdb_info.addr);
> + kfree(switchdev_work);
--
pw-bot: cr