Skip to content

Commit a69f5ed

Browse files
JoePerchesdavem330
authored andcommitted
mac_pton: Use bool not int return
Use bool instead of int as the return type. All uses are tested with !. Signed-off-by: Joe Perches <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f6d8cb2 commit a69f5ed

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

include/linux/kernel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ static inline char * __deprecated pack_hex_byte(char *buf, u8 byte)
501501
extern int hex_to_bin(char ch);
502502
extern int __must_check hex2bin(u8 *dst, const char *src, size_t count);
503503

504-
int mac_pton(const char *s, u8 *mac);
504+
bool mac_pton(const char *s, u8 *mac);
505505

506506
/*
507507
* General tracing related utility functions - trace_printk(),

lib/net_utils.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
#include <linux/ctype.h>
44
#include <linux/kernel.h>
55

6-
int mac_pton(const char *s, u8 *mac)
6+
bool mac_pton(const char *s, u8 *mac)
77
{
88
int i;
99

1010
/* XX:XX:XX:XX:XX:XX */
1111
if (strlen(s) < 3 * ETH_ALEN - 1)
12-
return 0;
12+
return false;
1313

1414
/* Don't dirty result unless string is valid MAC. */
1515
for (i = 0; i < ETH_ALEN; i++) {
1616
if (!isxdigit(s[i * 3]) || !isxdigit(s[i * 3 + 1]))
17-
return 0;
17+
return false;
1818
if (i != ETH_ALEN - 1 && s[i * 3 + 2] != ':')
19-
return 0;
19+
return false;
2020
}
2121
for (i = 0; i < ETH_ALEN; i++) {
2222
mac[i] = (hex_to_bin(s[i * 3]) << 4) | hex_to_bin(s[i * 3 + 1]);
2323
}
24-
return 1;
24+
return true;
2525
}
2626
EXPORT_SYMBOL(mac_pton);

0 commit comments

Comments
 (0)