Skip to content

Commit d84f18d

Browse files
Colin Ian Kingrafaeljw
authored andcommitted
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>
1 parent caf35cd commit d84f18d

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

‎drivers/base/swnode.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ fwnode_create_software_node(const struct property_entry *properties,
553553
{
554554
struct software_node *p = NULL;
555555
struct software_node *swnode;
556-
char node_name[20];
557556
int ret;
558557

559558
if (parent) {
@@ -576,8 +575,6 @@ fwnode_create_software_node(const struct property_entry *properties,
576575
}
577576

578577
swnode->id = ret;
579-
sprintf(node_name, "node%d", swnode->id);
580-
581578
swnode->kobj.kset = swnode_kset;
582579
swnode->fwnode.ops = &software_node_ops;
583580

@@ -590,7 +587,7 @@ fwnode_create_software_node(const struct property_entry *properties,
590587
list_add_tail(&swnode->entry, &p->children);
591588

592589
ret = kobject_init_and_add(&swnode->kobj, &software_node_type,
593-
p ? &p->kobj : NULL, node_name);
590+
p ? &p->kobj : NULL, "node%d", swnode->id);
594591
if (ret) {
595592
kobject_put(&swnode->kobj);
596593
return ERR_PTR(ret);

0 commit comments

Comments
 (0)