[v2,7/8] net/bnx2x: fix calloc parameters

Message ID 20240124185406.3598985-7-ferruh.yigit@amd.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2,1/8] pipeline: fix calloc parameters |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ferruh Yigit Jan. 24, 2024, 6:54 p.m. UTC
  gcc [1] generates warning [2] about rte_calloc usage, because
rte_calloc parameter order is wrong, fixing it by replacing parameters.

[1]
gcc (GCC) 14.0.1 20240124 (experimental)

[2]
Compiling C object drivers/libtmp_rte_net_bnx2x.a.p/net_bnx2x_bnx2x.c.o
../drivers/net/bnx2x/bnx2x.c: In function ‘bnx2x_alloc_ilt_lines_mem’:
../drivers/net/bnx2x/bnx2x.c:2392:44:
 warning: ‘rte_calloc’ sizes specified with ‘sizeof’ in the earlier
 argument and not in the later argument [-Wcalloc-transposed-args]
 2392 |                     sizeof(struct ilt_line), ILT_MAX_LINES,
      |                            ^~~~~~

Fixes: 540a211084a7 ("bnx2x: driver core")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
Cc: stephen@networkplumber.org
---
 drivers/net/bnx2x/bnx2x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Morten Brørup Jan. 24, 2024, 7:01 p.m. UTC | #1
> From: Ferruh Yigit [mailto:ferruh.yigit@amd.com]
> Sent: Wednesday, 24 January 2024 19.54
> 
> gcc [1] generates warning [2] about rte_calloc usage, because
> rte_calloc parameter order is wrong, fixing it by replacing parameters.
> 
> [1]
> gcc (GCC) 14.0.1 20240124 (experimental)
> 
> [2]
> Compiling C object drivers/libtmp_rte_net_bnx2x.a.p/net_bnx2x_bnx2x.c.o
> ../drivers/net/bnx2x/bnx2x.c: In function ‘bnx2x_alloc_ilt_lines_mem’:
> ../drivers/net/bnx2x/bnx2x.c:2392:44:
>  warning: ‘rte_calloc’ sizes specified with ‘sizeof’ in the earlier
>  argument and not in the later argument [-Wcalloc-transposed-args]
>  2392 |                     sizeof(struct ilt_line), ILT_MAX_LINES,
>       |                            ^~~~~~
> 
> Fixes: 540a211084a7 ("bnx2x: driver core")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@amd.com>
> ---

Acked-by: Morten Brørup <mb@smartsharesystems.com>
  

Patch

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index c3283c94f38f..597ee4335977 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -2389,7 +2389,7 @@  int bnx2x_alloc_ilt_mem(struct bnx2x_softc *sc)
 static int bnx2x_alloc_ilt_lines_mem(struct bnx2x_softc *sc)
 {
 	sc->ilt->lines = rte_calloc("",
-				    sizeof(struct ilt_line), ILT_MAX_LINES,
+				    ILT_MAX_LINES, sizeof(struct ilt_line),
 				    RTE_CACHE_LINE_SIZE);
 	return sc->ilt->lines == NULL;
 }