Messages in this thread | | | Subject | Re: [PATCH net-next v5] net: ti: icssg_prueth: add TAPRIO offload support | From | Paolo Abeni <> | Date | Thu, 02 May 2024 13:59:51 +0200 |
| |
On Mon, 2024-04-29 at 16:00 +0530, MD Danish Anwar wrote: > +static int emac_taprio_replace(struct net_device *ndev, > + struct tc_taprio_qopt_offload *taprio) > +{ > + struct prueth_emac *emac = netdev_priv(ndev); > + struct tc_taprio_qopt_offload *est_new; > + int ret; > + > + if (taprio->cycle_time_extension) { > + NL_SET_ERR_MSG_MOD(taprio->extack, "Cycle time extension not supported"); > + return -EOPNOTSUPP; > + } > + > + if (taprio->cycle_time < TAS_MIN_CYCLE_TIME) { > + NL_SET_ERR_MSG_FMT_MOD(taprio->extack, "cycle_time %llu is less than min supported cycle_time %d", > + taprio->cycle_time, TAS_MIN_CYCLE_TIME); > + return -EINVAL; > + } > + > + if (taprio->num_entries > TAS_MAX_CMD_LISTS) { > + NL_SET_ERR_MSG_FMT_MOD(taprio->extack, "num_entries %lu is more than max supported entries %d", > + taprio->num_entries, TAS_MAX_CMD_LISTS); > + return -EINVAL; > + } > + > + if (emac->qos.tas.taprio_admin) > + devm_kfree(&ndev->dev, emac->qos.tas.taprio_admin);
it looks like 'qos.tas.taprio_admin' is initialized from taprio_offload_get(), so it should be free with taprio_offload_free(), right?
> + > + est_new = devm_kzalloc(&ndev->dev, > + struct_size(est_new, entries, taprio->num_entries), > + GFP_KERNEL); > + if (!est_new) > + return -ENOMEM;
Why are you allocating 'est_new'? it looks like it's not used anywhere?!?
> + > + emac->qos.tas.taprio_admin = taprio_offload_get(taprio); > + ret = tas_update_oper_list(emac); > + if (ret) > + return ret;
Should the above clear 'taprio_admin' on error, as well?
> Thanks,
Paolo
| |