From patchwork Wed Aug 10 21:04:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 9274121 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 1EB3860467 for ; Wed, 10 Aug 2016 21:07:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CCD427FC0 for ; Wed, 10 Aug 2016 21:07:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 016C1283E9; Wed, 10 Aug 2016 21:07:17 +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 E741327FC0 for ; Wed, 10 Aug 2016 21:07:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932806AbcHJVHA (ORCPT ); Wed, 10 Aug 2016 17:07:00 -0400 Received: from mail-qt0-f175.google.com ([209.85.216.175]:35900 "EHLO mail-qt0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933869AbcHJVG7 (ORCPT ); Wed, 10 Aug 2016 17:06:59 -0400 Received: by mail-qt0-f175.google.com with SMTP id 52so27185445qtq.3 for ; Wed, 10 Aug 2016 14:06:59 -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=OqBBiZrFz7tiNHhK5enK13Rm0gs4o//TtkyT3UhvUSM=; b=euTrVk0CzTM/V9XJhWZrhC++pZjRc+/3bvN7DdkQvty9tG5381Gv8W8DFhWzXUAZoX QHcJgz5LNed4NZml4VRmP4TINTaIxYDOXDILPzoOcBElBW8BlyewOWMUfbv4msSnHxkA rriTwH4VsQ4Pyn42YU52knvruo3Q1Xoys5WMQ= 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=OqBBiZrFz7tiNHhK5enK13Rm0gs4o//TtkyT3UhvUSM=; b=IdXphIHeg2QTpcYIVHwDltCeUkCtOhbH1gvrTSY7Xx0hSVa8mErotr2xwJRyJ6LvbO oLFDlUG3PHagNVkxLdJu50k8cJCmej4jYEwGdNggsibA8OVitWANP5ys5NfE5SCr41U6 Dora2a4Mib5SjneO1JkOTtepl1O4sTfaqRGe+PWwkVe/y1hxkPWcZYT0ko2AGZcYpwbz zKzQWhrvJ2LhH4sgDE5ojknEZjEv775lzJF12UKRII6dYCi2dNx1NjHE+1V3QOzkNVPJ 0/H27cLSsUwyG+7lc1iVJBUai4NpbaNtMDH/h0hW1+Taw/XiIHn7kVS1InADfTPQWcao DzCg== X-Gm-Message-State: AEkoousfv+CcCy9QLU0jq5rxsAiVm4EBdUepzo4hJNThD0whU13hHYYA0D6zD3nnMJJoOgJu X-Received: by 10.237.60.112 with SMTP id u45mr6924496qte.27.1470863218498; Wed, 10 Aug 2016 14:06:58 -0700 (PDT) Received: from lbrmn-mmayer.lab.lan ([216.31.219.19]) by smtp.gmail.com with ESMTPSA id t42sm24370553qte.24.2016.08.10.14.06.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Aug 2016 14:06:58 -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 v5 7/7] power_supply: make use of new strcpytoupper() function Date: Wed, 10 Aug 2016 14:04:57 -0700 Message-Id: <1470863097-21138-8-git-send-email-mmayer@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470863097-21138-1-git-send-email-mmayer@broadcom.com> References: <1470863097-21138-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 Acked-By: Sebastian Reichel --- 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 bcde8d1..f3b77a3 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)