Skip to content

Commit e030d58

Browse files
AlanSterngregkh
authored andcommitted
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>
1 parent 6b6e39a commit e030d58

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

‎fs/sysfs/group.c‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,7 @@ int sysfs_merge_group(struct kobject *kobj,
165165
struct attribute *const *attr;
166166
int i;
167167

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);
172169
if (!dir_sd)
173170
return -ENOENT;
174171

@@ -195,10 +192,7 @@ void sysfs_unmerge_group(struct kobject *kobj,
195192
struct sysfs_dirent *dir_sd;
196193
struct attribute *const *attr;
197194

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);
202196
if (dir_sd) {
203197
for (attr = grp->attrs; *attr; ++attr)
204198
sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name);

0 commit comments

Comments
 (0)