Skip to content

Commit

Permalink
sysfs: remove useless test from sysfs_merge_group
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Nov 29, 2010
1 parent 6b6e39a commit e030d58
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions fs/sysfs/group.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ int sysfs_merge_group(struct kobject *kobj,
struct attribute *const *attr;
int i;

if (grp)
dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name);
else
dir_sd = sysfs_get(kobj->sd);
dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name);
if (!dir_sd)
return -ENOENT;

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

if (grp)
dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name);
else
dir_sd = sysfs_get(kobj->sd);
dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name);
if (dir_sd) {
for (attr = grp->attrs; *attr; ++attr)
sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name);
Expand Down

0 comments on commit e030d58

Please sign in to comment.