From patchwork Tue Jul 5 20:47:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 9215225 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 7C2C86048B for ; Tue, 5 Jul 2016 20:56:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E7832842E for ; Tue, 5 Jul 2016 20:56:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62E0828435; Tue, 5 Jul 2016 20:56:11 +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 E30642842E for ; Tue, 5 Jul 2016 20:56:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754692AbcGEU4J (ORCPT ); Tue, 5 Jul 2016 16:56:09 -0400 Received: from mail-qt0-f175.google.com ([209.85.216.175]:33528 "EHLO mail-qt0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753733AbcGEU4J (ORCPT ); Tue, 5 Jul 2016 16:56:09 -0400 Received: by mail-qt0-f175.google.com with SMTP id c34so107320913qte.0 for ; Tue, 05 Jul 2016 13:56:08 -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=dYepXsb+C5Th87jD7V4DLRcTvPRN2FclRwXPATM+uLiWLNNiesXVwX3AfZVYA475UE k2QnUVW9G8jqjh8YEvjhNJFFXCCpzIiCCsRiTB9Np+4FcVLUZtplVoofH3of5dgSMskJ zh1KhlSDzHo6CSv7vYxncsLcEhYGZyzihFC94= 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=LIBfwfdPfvo+b22KIrlSg4GZ0lrC65aq43fu7XJDVWSc6lps7IEyRC4OwsE1aHyASt UJE0j4L9i4ASpCV8rPjI/8X8W7DjJOe/3RaKvpV3l2zwjpXyv8Zw7BBQ7JaJckXUlcDf 7exIxazNUMZweP6IoZ0paHaPQaY7PBlWKzB595W8d3JaGgtod/yHvgvSF5KgFhDGGQ/4 s3bc2+ydAz/3LzP7n0NNbWjCTNMQtcL0nWLFu5DekKPRfUX5ZW/2u2kFWrkLvR0m8D8J 48LiTBWe2cKZCJBbXDTt5ZhAL8VSoT0UD1JEaJyBVe4KoVa1uTHIatA7WPiMTVgfYTjX zZSw== X-Gm-Message-State: ALyK8tJGLX9P/9jHnR6qFgWdSQRRBfas7mtvB40E78Pnlw6BfB3cAySMg4jz48BClPQHWAgz X-Received: by 10.200.48.46 with SMTP id f43mr30462390qte.10.1467751732478; Tue, 05 Jul 2016 13:48:52 -0700 (PDT) Received: from lbrmn-mmayer.lab.lan ([216.31.219.19]) by smtp.gmail.com with ESMTPSA id q187sm1323287qke.42.2016.07.05.13.48.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Jul 2016 13:48:52 -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 v2 7/7] power_supply: make use of new strcpytoupper() function Date: Tue, 5 Jul 2016 13:47:11 -0700 Message-Id: <1467751631-22878-8-git-send-email-mmayer@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467751631-22878-1-git-send-email-mmayer@broadcom.com> References: <1467751631-22878-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)