[v2] examples/rxtx_callbacks: fix port ID format specifier

Message ID 20210505215133.21818-1-dmitry.kozliuk@gmail.com (mailing list archive)
State Superseded, archived
Headers
Series [v2] examples/rxtx_callbacks: fix port ID format specifier |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Dmitry Kozlyuk May 5, 2021, 9:51 p.m. UTC
  This fixes -Wformat warning with clang 10.0.0 on Windows.

Fixes: f8244c6399d9 ("ethdev: increase port id range")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
v2: use PRIx16 instead of %u and a cast (Tyler, Thomas).

 examples/rxtx_callbacks/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Stephen Hemminger May 6, 2021, 2:54 a.m. UTC | #1
On Thu,  6 May 2021 00:51:33 +0300
Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:

> This fixes -Wformat warning with clang 10.0.0 on Windows.
> 
> Fixes: f8244c6399d9 ("ethdev: increase port id range")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
> v2: use PRIx16 instead of %u and a cast (Tyler, Thomas).
> 
>  examples/rxtx_callbacks/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
> index b57b2fc6bc..ecc2da2d8c 100644
> --- a/examples/rxtx_callbacks/main.c
> +++ b/examples/rxtx_callbacks/main.c
> @@ -329,7 +329,7 @@ main(int argc, char *argv[])
>  	/* initialize all ports */
>  	RTE_ETH_FOREACH_DEV(portid)
>  		if (port_init(portid, mbuf_pool) != 0)
> -			rte_exit(EXIT_FAILURE, "Cannot init port %"PRIu8"\n",
> +			rte_exit(EXIT_FAILURE, "Cannot init port %"PRIx16"\n",
>  					portid);
>  
>  	if (rte_lcore_count() > 1)

NAK

Just use %u  it works for uint16. Don't start using hex, no other places in
DPDK print port number in hex.
  

Patch

diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c
index b57b2fc6bc..ecc2da2d8c 100644
--- a/examples/rxtx_callbacks/main.c
+++ b/examples/rxtx_callbacks/main.c
@@ -329,7 +329,7 @@  main(int argc, char *argv[])
 	/* initialize all ports */
 	RTE_ETH_FOREACH_DEV(portid)
 		if (port_init(portid, mbuf_pool) != 0)
-			rte_exit(EXIT_FAILURE, "Cannot init port %"PRIu8"\n",
+			rte_exit(EXIT_FAILURE, "Cannot init port %"PRIx16"\n",
 					portid);
 
 	if (rte_lcore_count() > 1)