net: pasemi: Replace mac address parsing
Subsystems (2)
PATCH 1/1 net: pasemi: Replace mac address parsing
Replace sscanf() with mac_pton().
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/net/ethernet/pasemi/pasemi_mac.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/pasemi/pasemi_mac.c +1 -3
@@ -212,9 +212,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)return -ENOENT ; } -if (sscanf (maddr,"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx" , - &addr[0 ], &addr[1 ], &addr[2 ], &addr[3 ], &addr[4 ], &addr[5 ]) - !=ETH_ALEN ) { +if (!mac_pton (maddr, addr)) {dev_warn (&pdev->dev,"can't parse mac address, not configuring\n" );return -EINVAL ;
Signature · 1 line
2.15.1
Quoted 3 lines · Andy Shevchenko
Replace
sscanf()withmac_pton().Signed-off-by Andy Shevchenko <[email protected]>
You don't need to select GENERIC_NET_UTILS for that?
Quoted 20 lines
--- drivers/net/ethernet/pasemi/pasemi_mac.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/net/ethernet/pasemi/pasemi_mac.c +1
-3@@ -212,9 +212,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)return -ENOENT ; } -if (sscanf (maddr,"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx" , - &addr[0 ], &addr[1 ], &addr[2 ], &addr[3 ], &addr[4 ], &addr[5 ]) - !=ETH_ALEN ) { +if (!mac_pton (maddr, addr)) {dev_warn (&pdev->dev,"can't parse mac address, not configuring\n" );return -EINVAL ;
Signature · 1 line
~Randy
Quoted 6 lines · Randy Dunlap
Quoted 3 lines · Andy Shevchenko
Replace
sscanf()withmac_pton().Signed-off-by Andy Shevchenko <[email protected]>You don't need to select
GENERIC_NET_UTILSfor that?
It's done by CONFIG_NET.
Quoted 27 lines
Quoted 25 lines
--- drivers/net/ethernet/pasemi/pasemi_mac.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/net/ethernet/pasemi/pasemi_mac.c +1
-3@@ -212,9 +212,7 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)return -ENOENT ; } -if (sscanf (maddr,"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx" , - &addr[0 ], &addr[1 ], &addr[2 ], &addr[3 ], &addr[4], &addr[5]) - !=ETH_ALEN ) { +if (!mac_pton (maddr, addr)) { dev_warn(&pdev->dev,"can't parse mac address, not
configuring\n");
return-EINVAL;
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Quoted 10 lines · Andy Shevchenko
Quoted 6 lines · Randy Dunlap
Quoted 3 lines · Andy Shevchenko
Replace
sscanf()withmac_pton().Signed-off-by Andy Shevchenko <[email protected]>You don't need to select
GENERIC_NET_UTILSfor that?It's done by
CONFIG_NET.
Ah, thanks.
Signature · 1 line
~Randy
From: Andy Shevchenko <[email protected]>
Date: Tue, 19 Dec 2017 20:31:03 +0200
Quoted 3 lines
Replace
sscanf()withmac_pton().Signed-off-by Andy Shevchenko <[email protected]>
Applied to net-next.