sysfs: prevent warning when only using binary attributes
authorOliver Schinagl <oliver@schinagl.nl>
Sun, 14 Jul 2013 23:05:56 +0000 (16:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Jul 2013 17:57:36 +0000 (10:57 -0700)
When only using bin_attrs instead of attrs the kernel prints a warning
and refuses to create the sysfs entry. This fixes that.

Signed-off-by: Oliver Schinagl <oliver@schinagl.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/sysfs/group.c

index e5719c6095c3de13114a684c03d274cc2ff0dea2..09a1a25cd14540c77d0713b7d1ecd381f78c4886 100644 (file)
@@ -93,8 +93,8 @@ static int internal_create_group(struct kobject *kobj, int update,
        /* Updates may happen before the object has been instantiated */
        if (unlikely(update && !kobj->sd))
                return -EINVAL;
-       if (!grp->attrs) {
-               WARN(1, "sysfs: attrs not set by subsystem for group: %s/%s\n",
+       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);
                return -EINVAL;
        }