From patchwork Wed Sep 9 21:42:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 7149331 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D8C099F326 for ; Wed, 9 Sep 2015 21:42:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D1E12209A2 for ; Wed, 9 Sep 2015 21:42:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED5272099F for ; Wed, 9 Sep 2015 21:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752410AbbIIVmS (ORCPT ); Wed, 9 Sep 2015 17:42:18 -0400 Received: from mail-lb0-f178.google.com ([209.85.217.178]:33323 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751862AbbIIVmS (ORCPT ); Wed, 9 Sep 2015 17:42:18 -0400 Received: by lbcjc2 with SMTP id jc2so13267438lbc.0 for ; Wed, 09 Sep 2015 14:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id; bh=InlZjLjwEJivrwsOELtBWOcZdyXwAv1jQEXaRSbJDBU=; b=D3r67tMrmHAxxEpuj2f6tmZQvppsF4nnGNkT4cqaKkFN25jSN0xao3btA5HTutAIt0 wBGjL7L9cH+/sfgFnD7MUL4TXlT3wblg9tZWn66bFimjGLsN7l2M0qR1aND7uWKmSMpx WlMxRZwdCmDgrU+jeiwAggjF+AqpJYU943zJo= 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=InlZjLjwEJivrwsOELtBWOcZdyXwAv1jQEXaRSbJDBU=; b=GVZ1Ar+n7X6rRXrdctkIefXZNOaW2Y0+zBat8gG2SCH4dMHg5Ye1Li19mg3QdNlpXt MBCGMRQQVHXKptxkfHi4Y2ivoQ5luEKY2S5SElMPIMVda927As4J0CZcFGO+Ot4mDDX/ BXg1JGTuB/Wbmuy9lwkBw0D+ulbmQiwDoB+mvJVAyYdUurOHH0d/+pKRZe4XCW5F3cqG EQxaOw0IGVNVXnRLXHV88UMHd3pzMwxhDF4Quv21+ClJWYketIYPdy/KsdqDF0k8a5e+ SwXYsYbTCOrW5MXZSVkoZUFNn9T6G8arXYHITePCgpB7GM1hl3dCx+XMiOMUX6eq7SDZ NYrA== X-Gm-Message-State: ALoCoQk9tCJTfXlsqUe9xWabYqJd/USynTmsSPhvDP+pOUAZ3avzOoJPjMljm+SPoaIyEZQMkHPi X-Received: by 10.112.77.197 with SMTP id u5mr11443750lbw.120.1441834936732; Wed, 09 Sep 2015 14:42:16 -0700 (PDT) Received: from spencer.imf.au.dk ([130.225.20.51]) by smtp.gmail.com with ESMTPSA id y3sm2108582laj.37.2015.09.09.14.42.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Sep 2015 14:42:16 -0700 (PDT) From: Rasmus Villemoes To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman Cc: Rasmus Villemoes , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] PM / wakeup: wakeup_source_create: use kstrdup_const Date: Wed, 9 Sep 2015 23:42:06 +0200 Message-Id: <1441834926-14121-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Using kstrdup_const allows us to save a little runtime memory (and a string copy) in the common case where name is a string literal. Signed-off-by: Rasmus Villemoes --- drivers/base/power/wakeup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 51f15bc15774..332e607e0030 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -91,7 +91,7 @@ struct wakeup_source *wakeup_source_create(const char *name) if (!ws) return NULL; - wakeup_source_prepare(ws, name ? kstrdup(name, GFP_KERNEL) : NULL); + wakeup_source_prepare(ws, name ? kstrdup_const(name, GFP_KERNEL) : NULL); return ws; } EXPORT_SYMBOL_GPL(wakeup_source_create); @@ -154,7 +154,7 @@ void wakeup_source_destroy(struct wakeup_source *ws) wakeup_source_drop(ws); wakeup_source_record(ws); - kfree(ws->name); + kfree_const(ws->name); kfree(ws); } EXPORT_SYMBOL_GPL(wakeup_source_destroy);