[dpdk-dev] [PATCH] net/ice: fix memzone leak when firmware is missing

David Marchand david.marchand at redhat.com
Tue Jul 6 14:47:04 CEST 2021


On Tue, Jul 6, 2021 at 2:41 PM Wang, Haiyue <haiyue.wang at intel.com> wrote:
> > diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
> > index 09e38590e5..f85c7cc8da 100644
> > --- a/drivers/net/ice/ice_ethdev.c
> > +++ b/drivers/net/ice/ice_ethdev.c
> > @@ -2085,7 +2085,7 @@ ice_dev_init(struct rte_eth_dev *dev)
> >               if (ad->devargs.safe_mode_support == 0) {
> >                       PMD_INIT_LOG(ERR, "Failed to load the DDP package,"
> >                                       "Use safe-mode-support=1 to enter Safe Mode");
> > -                     return ret;
> > +                     goto err_init_fw;
> >               }
> >
> >               PMD_INIT_LOG(WARNING, "Failed to load the DDP package,"
> > @@ -2175,6 +2175,8 @@ ice_dev_init(struct rte_eth_dev *dev)
> >       rte_free(dev->data->mac_addrs);
> >       dev->data->mac_addrs = NULL;
> >  err_init_mac:
> > +     ice_free_hw_tbls(hw);
> > +err_init_fw:
> >       ice_sched_cleanup_all(hw);
> >       rte_free(hw->port_info);
> >       ice_shutdown_all_ctrlq(hw);
>
> The function 'ice_deinit_hw' should be used. ;-)
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/ethernet/intel/ice/ice_main.c#n4508

Well I was inspired by ice_dev_close(), so I guess this code too could
use some cleanup but I don't have the hw anymore to test this change.
I'll trust you and simply update ice_dev_init.


>
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
> index 09e38590e5..c777474468 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -2085,7 +2085,7 @@ ice_dev_init(struct rte_eth_dev *dev)
>                 if (ad->devargs.safe_mode_support == 0) {
>                         PMD_INIT_LOG(ERR, "Failed to load the DDP package,"
>                                         "Use safe-mode-support=1 to enter Safe Mode");
> -                       return ret;
> +                       goto err_init_fw;
>                 }
>
>                 PMD_INIT_LOG(WARNING, "Failed to load the DDP package,"
> @@ -2175,10 +2175,9 @@ ice_dev_init(struct rte_eth_dev *dev)
>         rte_free(dev->data->mac_addrs);
>         dev->data->mac_addrs = NULL;
>  err_init_mac:
> -       ice_sched_cleanup_all(hw);
> -       rte_free(hw->port_info);
> -       ice_shutdown_all_ctrlq(hw);
>         rte_free(pf->proto_xtr);
> +err_init_fw:

In such a case a single label should be enough, right?


> +       ice_deinit_hw(hw);
>
>         return ret;
>  }


-- 
David Marchand



More information about the dev mailing list