[dpdk-dev] examples/vhost_crypto: fix parsing

Message ID 20180409175740.86858-1-roy.fan.zhang@intel.com (mailing list archive)
State Not Applicable, archived
Delegated to: Maxime Coquelin
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Fan Zhang April 9, 2018, 5:57 p.m. UTC
  Fixes: 2ce5bd8c442d ("examples/vhost_crypto: add vhost crypto sample application")

This patch fixes the parsing of cryptodev id in the cmdline.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 examples/vhost_crypto/main.c | 5 -----
 1 file changed, 5 deletions(-)
  

Comments

Maxime Coquelin April 10, 2018, 9:40 a.m. UTC | #1
On 04/09/2018 07:57 PM, Fan Zhang wrote:
> Fixes: 2ce5bd8c442d ("examples/vhost_crypto: add vhost crypto sample application")
> 
> This patch fixes the parsing of cryptodev id in the cmdline.
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>   examples/vhost_crypto/main.c | 5 -----
>   1 file changed, 5 deletions(-)
> 
> diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
> index bc867240d..860200e29 100644
> --- a/examples/vhost_crypto/main.c
> +++ b/examples/vhost_crypto/main.c
> @@ -95,11 +95,6 @@ parse_cryptodev_id(const char *q_arg)
>   
>   	/* parse decimal string */
>   	pm = strtoul(q_arg, &end, 10);
> -	if ((pm == '\0') || (end == NULL) || (*end != '\0')) {
> -		RTE_LOG(ERR, USER1, "Invalid Cryptodev ID %s\n", q_arg);
> -		return -1;
> -	}
> -
>   	if (pm > rte_cryptodev_count()) {
>   		RTE_LOG(ERR, USER1, "Invalid Cryptodev ID %s\n", q_arg);
>   		return -1;
> 

Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>

I'll squash it with faulty commit if not yet merged by Ferruh.

Thanks,
Maxime
  

Patch

diff --git a/examples/vhost_crypto/main.c b/examples/vhost_crypto/main.c
index bc867240d..860200e29 100644
--- a/examples/vhost_crypto/main.c
+++ b/examples/vhost_crypto/main.c
@@ -95,11 +95,6 @@  parse_cryptodev_id(const char *q_arg)
 
 	/* parse decimal string */
 	pm = strtoul(q_arg, &end, 10);
-	if ((pm == '\0') || (end == NULL) || (*end != '\0')) {
-		RTE_LOG(ERR, USER1, "Invalid Cryptodev ID %s\n", q_arg);
-		return -1;
-	}
-
 	if (pm > rte_cryptodev_count()) {
 		RTE_LOG(ERR, USER1, "Invalid Cryptodev ID %s\n", q_arg);
 		return -1;