Skip to contentSkip to conversation

sysfs: fix warning when creating a sysfs group without attributes

PATCH New Javi Merino 1 participant 1 message Jan 15, 2015 Driver core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysfs: fix warning when creating a sysfs group without attributes

When attempting to create a gropu without attrs, the warning prints the name of the group. However, the check for name being a NULL pointer is
wrong: it uses the pointer to the name when it's NULL. Fix it to use the name if present, otherwise just put an empty string.

Cc Bruno Prémont <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 fs/sysfs/group.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/sysfs/group.c +1 -1
index 7d2a860ba788..2554d8835b48 100644
@@ -99,7 +99,7 @@ static int internal_create_group(struct kobject *kobj, int update,
 		return -EINVAL;
 	if (!grp->attrs && !grp->bin_attrs) {
 		WARN(1, "sysfs: (bin_)attrs not set by subsystem for group: %s/%s\n",
-			kobj->name, grp->name ? "" : grp->name);
+			kobj->name, grp->name ?: "");
 		return -EINVAL;
 	}
 	if (grp->name) {
Signature · 1 line
1.9.1