Commit e030d58e8860f1c87b17631dbdd70747cbe1fb5b
Committed by
Greg Kroah-Hartman
1 parent
6b6e39a6a8
Exists in
master
and in
4 other branches
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>
Showing 1 changed file with 2 additions and 8 deletions Side-by-side Diff
fs/sysfs/group.c
... | ... | @@ -165,10 +165,7 @@ |
165 | 165 | struct attribute *const *attr; |
166 | 166 | int i; |
167 | 167 | |
168 | - if (grp) | |
169 | - dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); | |
170 | - else | |
171 | - dir_sd = sysfs_get(kobj->sd); | |
168 | + dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); | |
172 | 169 | if (!dir_sd) |
173 | 170 | return -ENOENT; |
174 | 171 | |
... | ... | @@ -195,10 +192,7 @@ |
195 | 192 | struct sysfs_dirent *dir_sd; |
196 | 193 | struct attribute *const *attr; |
197 | 194 | |
198 | - if (grp) | |
199 | - dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); | |
200 | - else | |
201 | - dir_sd = sysfs_get(kobj->sd); | |
195 | + dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); | |
202 | 196 | if (dir_sd) { |
203 | 197 | for (attr = grp->attrs; *attr; ++attr) |
204 | 198 | sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); |