From patchwork Wed Jan 21 11:52:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 431444 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0AC8914010F for ; Wed, 21 Jan 2015 22:52:51 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752479AbbAULwb (ORCPT ); Wed, 21 Jan 2015 06:52:31 -0500 Received: from mail-la0-f46.google.com ([209.85.215.46]:39788 "EHLO mail-la0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752463AbbAULw2 (ORCPT ); Wed, 21 Jan 2015 06:52:28 -0500 Received: by mail-la0-f46.google.com with SMTP id s18so18791615lam.5 for ; Wed, 21 Jan 2015 03:52:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IpP1KASJ9+JLXzQIsMhzOhAyYW/unhWQnGv3VKvZd/c=; b=OcSOrmm/xStff223QxfgraHPJ8n9Oj8adv4RDrc9SvWl8wlhpjOkndqSRdq1M39xIq 6N4myxWzCOBZjuUo1+7WAvsrl6WGWdFMAIjXYga7xfyCWZskkzgNs05KnLrjQp4Q058e 0mOD0jBWsgO8H4JdM5zYXptvosyNhWtDHbqAE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=IpP1KASJ9+JLXzQIsMhzOhAyYW/unhWQnGv3VKvZd/c=; b=U/Nyn4BxjhHxYbPvsWnJrudf9Nco639KxfMzZiH1fVVxHeXjJgUs/wTNShf/sAla43 vY5xGIgbHFyFVGeebX16Wu0s6rV3Q+/WaPqH1hC7PjpZ/BaZrOP5gsKjMJ2C92bH/Uon 5MeGm50fc0TY4FS2nFZfoFO8WY2jMwd+L9FMOITOUozv9Spgl14F5MM69+pzILDso+0Q bao0mfUkYFAdUpX7/SpMuzX4yIxbMXGy8Z5HqOkE2VuYxLFJtE35NBYo7JU7mOYzb5b7 H801UoOnostNQQtRT3/vxhuvoqzejwRBJDZxFcs4t4mEmre68S1zr39UH6SAALTXPnXi Rnxw== X-Gm-Message-State: ALoCoQkt7rcXgEa4Cnb09JASqDhsY+gBxAwxvITz1i9oT28by3hlEiVQS5tXtgbm+tIZzAQkTQpJ X-Received: by 10.112.159.195 with SMTP id xe3mr43236140lbb.64.1421841147023; Wed, 21 Jan 2015 03:52:27 -0800 (PST) Received: from spencer.imf.au.dk ([130.225.20.51]) by mx.google.com with ESMTPSA id a1sm4861747lbi.11.2015.01.21.03.52.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Jan 2015 03:52:26 -0800 (PST) From: Rasmus Villemoes To: Simon Kelley , Kalle Valo Cc: Sergei Shtylyov , Rasmus Villemoes , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] net: wireless: atmel: Remove open-coded and wrong strcasecmp Date: Wed, 21 Jan 2015 12:52:07 +0100 Message-Id: <1421841127-8209-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1421414907-26764-1-git-send-email-linux@rasmusvillemoes.dk> References: <1421414907-26764-1-git-send-email-linux@rasmusvillemoes.dk> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- v2: Address Sergei's comments to the commit message. drivers/net/wireless/atmel.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) 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; }