From patchwork Fri Jul 22 23:31:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 9244405 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 493AC6088F for ; Fri, 22 Jul 2016 23:33:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3A8B5281A7 for ; Fri, 22 Jul 2016 23:33:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2CE2A27F94; Fri, 22 Jul 2016 23:33:48 +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 A32F527F94 for ; Fri, 22 Jul 2016 23:33:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753138AbcGVXdl (ORCPT ); Fri, 22 Jul 2016 19:33:41 -0400 Received: from mail-qk0-f169.google.com ([209.85.220.169]:32889 "EHLO mail-qk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753131AbcGVXdj (ORCPT ); Fri, 22 Jul 2016 19:33:39 -0400 Received: by mail-qk0-f169.google.com with SMTP id p74so114504478qka.0 for ; Fri, 22 Jul 2016 16:33:39 -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=Jm7EQRJxEyfO654pESg1V6UodTXvTPk7BF6X9ocDd1BIKTBJtYOkwBsPsSlbZ4HDCx YRSEBOebqaFF70zmzh9aY/2D9BbTILIgrxucQPM81Nx7M6sybUoiRlDhtP1QZmPtEJuT w6xfs5DadkprzErdJTyw3kVKLRFcbKcRybPXk= 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=i4OkQbUQchxZNHpo05DMyYwwYXc+LzUnG2OCAByrrU70Sp6TRjtPWwrj75bFHbMSDy 8Th7bKvz/OMaGXNutFe91vOHXLE9seFNMtfK/NvCKe0a1X20zacZthpZ8mkTWY8GOmkf 7lhUnSQx0ptMiI+L9OWJAP4rWWlPrrPXiShY22I1oo1SpM6mNRgeYqFMYYK3dSZWeZY3 4SdOgb/m4z/iQ/aMS0pj6iCgUchvXGSCd6Bcf11yloYDOfj8vldCX3L9kufSPMUrC5P7 xzGWYoXKY/mp9vyT9IHf8s9W8o2s7gLA//baPBdHL4OzIzmeYH10d6o95SWrPJEVdKk9 hzhg== X-Gm-Message-State: AEkoousV3Rd3f5Jg0QgzBVHVcdtmT0yjL5VacEIoSX1yNsusjb7C8bGyrby0gaHikJFFLZeT X-Received: by 10.55.76.201 with SMTP id z192mr8101017qka.182.1469230418545; Fri, 22 Jul 2016 16:33:38 -0700 (PDT) Received: from lbrmn-mmayer.lab.lan ([216.31.219.19]) by smtp.gmail.com with ESMTPSA id c23sm8672867qtc.45.2016.07.22.16.33.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Jul 2016 16:33:37 -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 v4 7/7] power_supply: make use of new strcpytoupper() function Date: Fri, 22 Jul 2016 16:31:09 -0700 Message-Id: <1469230269-1644-8-git-send-email-mmayer@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1469230269-1644-1-git-send-email-mmayer@broadcom.com> References: <1469230269-1644-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 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)