From: Colin King <colin.king@canonical.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rafael@kernel.org>
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH][next] drivers: base: remove need for a temporary string for the node name
Date: Thu, 29 Nov 2018 18:08:44 +0000 [thread overview]
Message-ID: <20181129180844.31138-1-colin.king@canonical.com> (raw)
From: Colin Ian King <colin.king@canonical.com>
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 <colin.king@canonical.com>
---
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);
--
2.19.1
next reply other threads:[~2018-11-29 18:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-29 18:08 Colin King [this message]
2018-12-06 14:57 ` Greg Kroah-Hartman
2018-12-06 15:23 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181129180844.31138-1-colin.king@canonical.com \
--to=colin.king@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®