From: Rasmus Villemoes Date: Wed, 21 Jan 2015 11:52:07 +0000 (+0100) Subject: atmel: Remove open-coded and wrong strcasecmp X-Git-Tag: v4.0-rc1~133^2~130^2~1 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=908414af255ea974bd0cfe54918d7957cd457d15;p=linux.git atmel: Remove open-coded and wrong strcasecmp The kernel's string library does in fact have strcasecmp, at least since ded220bd8f08 ("[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 Signed-off-by: Kalle Valo --- diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 9183f1cf89a7..55db9f03eb2a 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -2699,16 +2698,7 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) domain[REGDOMAINSZ] = 0; rc = -EINVAL; for (i = 0; i < ARRAY_SIZE(channel_table); i++) { - /* strcasecmp doesn't exist in the library */ - char *a = channel_table[i].name; - char *b = domain; - while (*a) { - char c1 = *a++; - char c2 = *b++; - if (tolower(c1) != tolower(c2)) - break; - } - if (!*a && !*b) { + if (!strcasecmp(channel_table[i].name, domain)) { priv->config_reg_domain = channel_table[i].reg_domain; rc = 0; }