From patchwork Thu Dec 6 17:05:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 10716435 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5F73C14E2 for ; Thu, 6 Dec 2018 17:06:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AFBA2EEAC for ; Thu, 6 Dec 2018 17:06:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F0E42F0F3; Thu, 6 Dec 2018 17:06:01 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 DE9612EEAC for ; Thu, 6 Dec 2018 17:06:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726036AbeLFRGA (ORCPT ); Thu, 6 Dec 2018 12:06:00 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:44521 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725942AbeLFRF7 (ORCPT ); Thu, 6 Dec 2018 12:05:59 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1gUx65-0001Z2-Qu; Thu, 06 Dec 2018 17:05:57 +0000 From: Colin King To: Greg Kroah-Hartman , "Rafael J . Wysocki" , linux-acpi@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next][RESEND] drivers: base: remove need for a temporary string for the node name Date: Thu, 6 Dec 2018 17:05:57 +0000 Message-Id: <20181206170557.27834-1-colin.king@canonical.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Ian King Currently the node name is being formatting into a temporary string node_name, however, kobject_init_and_add allows one to format up a node name, so use that instead. This removes the need for the node_name string and also cleans up the following warning: Fixes clang warning: warning: format string is not a string literal (potentially insecure) [-Wformat-security] Signed-off-by: Colin Ian King --- drivers/base/swnode.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 9c63ec8d8ab4..306bb93287af 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -553,7 +553,6 @@ fwnode_create_software_node(const struct property_entry *properties, { struct software_node *p = NULL; struct software_node *swnode; - char node_name[20]; int ret; if (parent) { @@ -576,8 +575,6 @@ fwnode_create_software_node(const struct property_entry *properties, } swnode->id = ret; - sprintf(node_name, "node%d", swnode->id); - swnode->kobj.kset = swnode_kset; swnode->fwnode.ops = &software_node_ops; @@ -590,7 +587,7 @@ fwnode_create_software_node(const struct property_entry *properties, list_add_tail(&swnode->entry, &p->children); ret = kobject_init_and_add(&swnode->kobj, &software_node_type, - p ? &p->kobj : NULL, node_name); + p ? &p->kobj : NULL, "node%d", swnode->id); if (ret) { kobject_put(&swnode->kobj); return ERR_PTR(ret);