From 50e249437811c9150e3ade4a4ee08a7d8d3ee5ec Mon Sep 17 00:00:00 2001 From: Michael Baum Date: Wed, 24 Jun 2020 13:29:55 +0000 Subject: [PATCH] net/mlx4: use anonymous Direct Verbs allocator argument The mlx4_pci_probe function defines an struct mlx4dv_ctx_allocators type variable several hundred rows after it starts, with the only use it being passed as a parameter to the mlx4_glue->dv_set_context_attr function. However, according to DPDK Coding Style Guidelines, variables should be declared at the start of a block of code rather than in the middle. Therefore, to improve the Coding Style, the variable is passed directly to the function without declaring it before. Signed-off-by: Michael Baum Acked-by: Matan Azrad --- drivers/net/mlx4/mlx4.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 5d7202720b..ff270b465e 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -1054,14 +1054,13 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) eth_dev->dev_ops = &mlx4_dev_ops; #ifdef HAVE_IBV_MLX4_BUF_ALLOCATORS /* Hint libmlx4 to use PMD allocator for data plane resources */ - struct mlx4dv_ctx_allocators alctr = { - .alloc = &mlx4_alloc_verbs_buf, - .free = &mlx4_free_verbs_buf, - .data = priv, - }; err = mlx4_glue->dv_set_context_attr (ctx, MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS, - (void *)((uintptr_t)&alctr)); + (void *)((uintptr_t)&(struct mlx4dv_ctx_allocators){ + .alloc = &mlx4_alloc_verbs_buf, + .free = &mlx4_free_verbs_buf, + .data = priv, + })); if (err) WARN("Verbs external allocator is not supported"); else -- 2.20.1