summaryrefslogtreecommitdiff
path: root/drivers/base/swnode.c
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2018-12-06 17:05:57 +0000
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-12-11 12:18:15 +0100
commitd84f18d6673f6d93bddfce1aea6cfdd78b822d3e (patch)
tree5a3de28afb7b25be7056a8cb0fe1f4187b92ca39 /drivers/base/swnode.c
parentcaf35cd52242a0a184e0530f9814ab50759fa772 (diff)
drivers: base: swnode: remove need for a temporary string for the node name
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> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/swnode.c')
-rw-r--r--drivers/base/swnode.c5
1 files changed, 1 insertions, 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);