On 12/14/2023 10:24 AM, Chaoyong He wrote:
> From: Long Wu <long...@corigine.com>
> 
> Set the representor array to NULL to avoid that close interface
> does not free some resource.
> 
> Fixes: a135bc1644d6 ("net/nfp: fix resource leak for flower firmware")
> Cc: chaoyong...@corigine.com
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Long Wu <long...@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong...@corigine.com>
> Reviewed-by: Peng Zhang <peng.zh...@corigine.com>
> ---
>  drivers/net/nfp/flower/nfp_flower_representor.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c 
> b/drivers/net/nfp/flower/nfp_flower_representor.c
> index 27ea3891bd..5f7c1fa737 100644
> --- a/drivers/net/nfp/flower/nfp_flower_representor.c
> +++ b/drivers/net/nfp/flower/nfp_flower_representor.c
> @@ -294,17 +294,30 @@ nfp_flower_repr_tx_burst(void *tx_queue,
>  static int
>  nfp_flower_repr_uninit(struct rte_eth_dev *eth_dev)
>  {
> +     uint16_t index;
>       struct nfp_flower_representor *repr;
>  
>       repr = eth_dev->data->dev_private;
>       rte_ring_free(repr->ring);
>  
> +     if (repr->repr_type == NFP_REPR_TYPE_PHYS_PORT) {
> +             index = NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(repr->port_id);
> +             repr->app_fw_flower->phy_reprs[index] = NULL;
> +     } else {
> +             index = repr->vf_id;
> +             repr->app_fw_flower->vf_reprs[index] = NULL;
> +     }
> +
>       return 0;
>  }
>  
>  static int
> -nfp_flower_pf_repr_uninit(__rte_unused struct rte_eth_dev *eth_dev)
> +nfp_flower_pf_repr_uninit(struct rte_eth_dev *eth_dev)
>  {
> +     struct nfp_flower_representor *repr = eth_dev->data->dev_private;
> +
> +     repr->app_fw_flower->pf_repr = NULL;
> 

Here it is assigned to NULL but is it freed? If freed, why not set to
NULL where it is freed?

Same for above phy_reprs & vf_reprs.

Reply via email to