Skip to content

Commit 908414a

Browse files
VillemoesKalle Valo
authored andcommitted
atmel: Remove open-coded and wrong strcasecmp
The kernel's string library does in fact have strcasecmp, at least since ded220b ("[STRING]: Move strcasecmp/strncasecmp to lib/string.c"). Moreover, this open-coded version is in fact wrong: If the strings only differ in their last character, a and b have already been incremented to point to the terminating NUL bytes, so they would wrongly be treated as equal. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
1 parent 961d1bb commit 908414a

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

‎drivers/net/wireless/atmel.c‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include <linux/ptrace.h>
4646
#include <linux/slab.h>
4747
#include <linux/string.h>
48-
#include <linux/ctype.h>
4948
#include <linux/timer.h>
5049
#include <asm/byteorder.h>
5150
#include <asm/io.h>
@@ -2699,16 +2698,7 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
26992698
domain[REGDOMAINSZ] = 0;
27002699
rc = -EINVAL;
27012700
for (i = 0; i < ARRAY_SIZE(channel_table); i++) {
2702-
/* strcasecmp doesn't exist in the library */
2703-
char *a = channel_table[i].name;
2704-
char *b = domain;
2705-
while (*a) {
2706-
char c1 = *a++;
2707-
char c2 = *b++;
2708-
if (tolower(c1) != tolower(c2))
2709-
break;
2710-
}
2711-
if (!*a && !*b) {
2701+
if (!strcasecmp(channel_table[i].name, domain)) {
27122702
priv->config_reg_domain = channel_table[i].reg_domain;
27132703
rc = 0;
27142704
}

0 commit comments

Comments
 (0)