diff options
Diffstat (limited to 'fs/sysfs/file.c')
-rw-r--r-- | fs/sysfs/file.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index 8acf82bba44c..a271c87c4472 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -523,7 +523,11 @@ int sysfs_add_file_to_group(struct kobject *kobj, | |||
523 | struct sysfs_dirent *dir_sd; | 523 | struct sysfs_dirent *dir_sd; |
524 | int error; | 524 | int error; |
525 | 525 | ||
526 | dir_sd = sysfs_get_dirent(kobj->sd, group); | 526 | if (group) |
527 | dir_sd = sysfs_get_dirent(kobj->sd, group); | ||
528 | else | ||
529 | dir_sd = sysfs_get(kobj->sd); | ||
530 | |||
527 | if (!dir_sd) | 531 | if (!dir_sd) |
528 | return -ENOENT; | 532 | return -ENOENT; |
529 | 533 | ||
@@ -611,7 +615,10 @@ void sysfs_remove_file_from_group(struct kobject *kobj, | |||
611 | { | 615 | { |
612 | struct sysfs_dirent *dir_sd; | 616 | struct sysfs_dirent *dir_sd; |
613 | 617 | ||
614 | dir_sd = sysfs_get_dirent(kobj->sd, group); | 618 | if (group) |
619 | dir_sd = sysfs_get_dirent(kobj->sd, group); | ||
620 | else | ||
621 | dir_sd = sysfs_get(kobj->sd); | ||
615 | if (dir_sd) { | 622 | if (dir_sd) { |
616 | sysfs_hash_and_remove(dir_sd, attr->name); | 623 | sysfs_hash_and_remove(dir_sd, attr->name); |
617 | sysfs_put(dir_sd); | 624 | sysfs_put(dir_sd); |