Commit 908414af authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Kalle Valo

atmel: Remove open-coded and wrong strcasecmp

The kernel's string library does in fact have strcasecmp, at least
since ded220bd ("[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: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 961d1bbe
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/ctype.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -2699,16 +2698,7 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -2699,16 +2698,7 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
domain[REGDOMAINSZ] = 0; domain[REGDOMAINSZ] = 0;
rc = -EINVAL; rc = -EINVAL;
for (i = 0; i < ARRAY_SIZE(channel_table); i++) { for (i = 0; i < ARRAY_SIZE(channel_table); i++) {
/* strcasecmp doesn't exist in the library */ if (!strcasecmp(channel_table[i].name, domain)) {
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) {
priv->config_reg_domain = channel_table[i].reg_domain; priv->config_reg_domain = channel_table[i].reg_domain;
rc = 0; rc = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment