diff options
| author | Alan Stern <stern@rowland.harvard.edu> | 2010-11-15 15:46:07 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-11-29 14:59:53 -0500 |
| commit | e030d58e8860f1c87b17631dbdd70747cbe1fb5b (patch) | |
| tree | 5eca982d7e71086db7e743eb575da019790b89bb | |
| parent | 6b6e39a6a8da7234c538d14c43d3583da8875f9c (diff) | |
sysfs: remove useless test from sysfs_merge_group
Dan Carpenter pointed out that the new sysfs_merge_group() and
sysfs_unmerge_group() routines requires their grp argument to be
non-NULL, because they dereference grp to obtain the list of
attributes. Hence it's pointless for the routines to include a test
and special-case handling for when grp is NULL. This patch (as1433)
removes the unneeded tests.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
| -rw-r--r-- | fs/sysfs/group.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 442f34ff1af8..c8769dc222d8 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c | |||
| @@ -165,10 +165,7 @@ int sysfs_merge_group(struct kobject *kobj, | |||
| 165 | struct attribute *const *attr; | 165 | struct attribute *const *attr; |
| 166 | int i; | 166 | int i; |
| 167 | 167 | ||
| 168 | if (grp) | 168 | dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); |
| 169 | dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); | ||
| 170 | else | ||
| 171 | dir_sd = sysfs_get(kobj->sd); | ||
| 172 | if (!dir_sd) | 169 | if (!dir_sd) |
| 173 | return -ENOENT; | 170 | return -ENOENT; |
| 174 | 171 | ||
| @@ -195,10 +192,7 @@ void sysfs_unmerge_group(struct kobject *kobj, | |||
| 195 | struct sysfs_dirent *dir_sd; | 192 | struct sysfs_dirent *dir_sd; |
| 196 | struct attribute *const *attr; | 193 | struct attribute *const *attr; |
| 197 | 194 | ||
| 198 | if (grp) | 195 | dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); |
| 199 | dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); | ||
| 200 | else | ||
| 201 | dir_sd = sysfs_get(kobj->sd); | ||
| 202 | if (dir_sd) { | 196 | if (dir_sd) { |
| 203 | for (attr = grp->attrs; *attr; ++attr) | 197 | for (attr = grp->attrs; *attr; ++attr) |
| 204 | sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); | 198 | sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); |
