[PATCH v2 02/15] net/zxdh: zxdh np uninit implementation
Stephen Hemminger
stephen at networkplumber.org
Fri Dec 13 20:38:52 CET 2024
On Tue, 10 Dec 2024 13:53:20 +0800
Junlong Wang <wang.junlong1 at zte.com.cn> wrote:
> (np)network processor release resources in host.
>
> Signed-off-by: Junlong Wang <wang.junlong1 at zte.com.cn>
> ---
> drivers/net/zxdh/zxdh_ethdev.c | 48 ++++
> drivers/net/zxdh/zxdh_np.c | 494 ++++++++++++++++++++++++++++++++-
> drivers/net/zxdh/zxdh_np.h | 107 +++++++
> 3 files changed, 647 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/zxdh/zxdh_ethdev.c b/drivers/net/zxdh/zxdh_ethdev.c
> index c54d1f6669..b28ea4ae6f 100644
> --- a/drivers/net/zxdh/zxdh_ethdev.c
> +++ b/drivers/net/zxdh/zxdh_ethdev.c
> @@ -841,6 +841,51 @@ zxdh_dev_configure(struct rte_eth_dev *dev)
> return ret;
> }
>
> +static void
> +zxdh_np_dtb_data_res_free(struct zxdh_hw *hw)
> +{
> + struct rte_eth_dev *dev = hw->eth_dev;
> + int ret = 0;
> + int i = 0;
> +
Why initialize these variables (ret and i)?
They are set immediately later in the loop.
Programmers are often taught to always initialize all variables,
but doing so defeats the checking in modern compilers that are able
to detect variables that are used uninitialized.
More information about the dev
mailing list