[v8,09/11] net/failsafe: use common ether address parsing routine

Message ID 20190705171626.13448-10-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series ether: improvements and optimizations |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Stephen Hemminger July 5, 2019, 5:16 p.m. UTC
  Use rte_ether_unformat_addr rather than sscanf.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 drivers/net/failsafe/failsafe_args.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
  

Patch

diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c
index d2e725bcea13..707490b94c4e 100644
--- a/drivers/net/failsafe/failsafe_args.c
+++ b/drivers/net/failsafe/failsafe_args.c
@@ -368,15 +368,11 @@  fs_get_mac_addr_arg(const char *key __rte_unused,
 		const char *value, void *out)
 {
 	struct rte_ether_addr *ea = out;
-	int ret;
 
 	if ((value == NULL) || (out == NULL))
 		return -EINVAL;
-	ret = sscanf(value, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
-		&ea->addr_bytes[0], &ea->addr_bytes[1],
-		&ea->addr_bytes[2], &ea->addr_bytes[3],
-		&ea->addr_bytes[4], &ea->addr_bytes[5]);
-	return ret != RTE_ETHER_ADDR_LEN;
+
+	return rte_ether_unformat_addr(value, ea);
 }
 
 int