From patchwork Fri Jan 16 13:28:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 429844 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 82411140190 for ; Sat, 17 Jan 2015 00:29:09 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753718AbbAPN2t (ORCPT ); Fri, 16 Jan 2015 08:28:49 -0500 Received: from mail-la0-f41.google.com ([209.85.215.41]:56554 "EHLO mail-la0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752652AbbAPN2s (ORCPT ); Fri, 16 Jan 2015 08:28:48 -0500 Received: by mail-la0-f41.google.com with SMTP id hv19so18866895lab.0 for ; Fri, 16 Jan 2015 05:28:47 -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; bh=aa+cpzLcfQ/+JEKeEOT0gGxG2+BGiMb0XDxjX6oHcHg=; b=W6H2xbUms4/nhZ/N+3VNwdnexAf7N0qAkCDBtfCf1ZAyOcdyCo3I5rO4xK93aRfiSZ /XZWw73z/1svJwjruI+3eOljFCsqRAX/CKroxBCAinI2tjj6mNG2yHaiIg28BlXEBLdC iq/E7acXck3ILuCz5AQtWkM+iL9ekos6SQSXo= 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; bh=aa+cpzLcfQ/+JEKeEOT0gGxG2+BGiMb0XDxjX6oHcHg=; b=arHC4PnfQjPvi3dV8r7PiLRGqF/6My+G4h4kFg6hZMMiQ0PP7+3YIVn7ImTcsOMOmh Qa1kWnxcqf+hrqXsxlyD9Q+RawUzP8+yY+56VviByUUe1uZ/33X8BLdORZQmL9UjmD+B 2p76EFuE317cKWkg6bV2mZ+0CJGgu6knz45gzJ0/Ed0m8ReullzQg5Kea7B/TV/mq+Cn 4IqrZRYVzArum3o4PaUXXLLcCI7VTQAuNISd8/5bLyK1kxvesaPofG5fbQlRvL4JQmBz AEFR0TvMK4Z9C35qHAaLc8blqvYqrBw1EGtmpqGUcoxfsz0aM0Eonc696KjdDMDKwNIl llBg== X-Gm-Message-State: ALoCoQnDlYrpu/gtw7/ZCmZdk7yhnGWL4zKnAVUKGW13etEx4oQAEWxpewwbIw2mVqJLmXinHsDI X-Received: by 10.152.8.11 with SMTP id n11mr15299912laa.38.1421414927256; Fri, 16 Jan 2015 05:28:47 -0800 (PST) Received: from spencer.imf.au.dk ([130.225.20.51]) by mx.google.com with ESMTPSA id zt4sm895848lbb.3.2015.01.16.05.28.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Jan 2015 05:28:46 -0800 (PST) From: Rasmus Villemoes To: Simon Kelley , Kalle Valo Cc: Rasmus Villemoes , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: wireless: atmel: Remove open-coded and wrong strcasecmp Date: Fri, 16 Jan 2015 14:28:27 +0100 Message-Id: <1421414907-26764-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 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. 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 be treated as equal. Signed-off-by: Rasmus Villemoes --- 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; }