From patchwork Fri Jul 8 22:43:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 9221877 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BB4CA6127E for ; Fri, 8 Jul 2016 22:44:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A989F285C9 for ; Fri, 8 Jul 2016 22:44:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9DEB3285F3; Fri, 8 Jul 2016 22:44:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 58345285F1 for ; Fri, 8 Jul 2016 22:44:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932925AbcGHWoi (ORCPT ); Fri, 8 Jul 2016 18:44:38 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:34387 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932915AbcGHWod (ORCPT ); Fri, 8 Jul 2016 18:44:33 -0400 Received: by mail-pa0-f44.google.com with SMTP id fi15so2941595pac.1 for ; Fri, 08 Jul 2016 15:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+sdQFEF0FbumQKlFgBRJrTAgR6hWJyE+KXhcNEtYa88=; b=Qskk4zWOwNMShtJh+wykzKugHQhHoW6M7veUP4rxUhWEF63uLfu/agwAsQgNuNgqYg r+Hqcb/Uv6tACNJDRsn0pUCfGywq4f3heoLibY3sdaib57Vjz1fUt7J+tOXyOWc/v5zS uMMHTU8qAIZ6/ZYAs6e+F4W5gZ+uslVAsTCgY= 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=+sdQFEF0FbumQKlFgBRJrTAgR6hWJyE+KXhcNEtYa88=; b=j2OXwp7motH52+66gIgu397IQ3mDV0nInqb5QCcPl0t/aL1cEe6FJYgRtU49lpyfCf rPY4UBxAQPajSsIDEI7MQ6OuBaYBytuGuNs6LgR2gk6inbddSlG18tmlqt73uM5mHMZ7 Aonxafcak6HUAW+55TwkrqTjVVWnCwHdDnJUWsfbbACHiEjOcHNWfewxiSyc47y8EYDS ztiJoi9XrX3h+VEly55p5KGkQKFKQxDUt5XCYHXl05ta6be0sY73PMf3Jow88yzX3oN3 akoNFoDzQ2qjnXUZOiBjr/aCdCo3bgu+EGWuaJIuqXfYVxjalMZhuhaQqJdro0zfLmfe xAKA== X-Gm-Message-State: ALyK8tIAj+EnmI2/l0/lf7nP4XCBB6j5nDYEsxblRpX9cTlPqpdMPxwAObtmrTlhbzUOROwi X-Received: by 10.66.173.38 with SMTP id bh6mr14016710pac.116.1468017872079; Fri, 08 Jul 2016 15:44:32 -0700 (PDT) Received: from lbrmn-mmayer.lab.lan ([216.31.219.19]) by smtp.gmail.com with ESMTPSA id br6sm5796387pac.0.2016.07.08.15.44.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jul 2016 15:44:31 -0700 (PDT) From: Markus Mayer To: Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse Cc: Markus Mayer , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 7/7] power_supply: make use of new strcpytoupper() function Date: Fri, 8 Jul 2016 15:43:14 -0700 Message-Id: <1468017794-4818-8-git-send-email-mmayer@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1468017794-4818-1-git-send-email-mmayer@broadcom.com> References: <1468017794-4818-1-git-send-email-mmayer@broadcom.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Call strcpytoupper() rather than walking the string explicitly to convert it to uppercase. Signed-off-by: Markus Mayer --- drivers/power/power_supply_sysfs.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c index 80fed98..20fdcc5 100644 --- a/drivers/power/power_supply_sysfs.c +++ b/drivers/power/power_supply_sysfs.c @@ -256,19 +256,16 @@ void power_supply_init_attrs(struct device_type *dev_type) static char *kstruprdup(const char *str, gfp_t gfp) { - char *ret, *ustr; + char *ustr; - ustr = ret = kmalloc(strlen(str) + 1, gfp); + ustr = kmalloc(strlen(str) + 1, gfp); - if (!ret) + if (!ustr) return NULL; - while (*str) - *ustr++ = toupper(*str++); + strcpytoupper(ustr, str); - *ustr = 0; - - return ret; + return ustr; } int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)