diff options
-rw-r--r-- | fs/sysfs/dir.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 837073dbadf4..5da8da806660 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -756,24 +756,19 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, | |||
756 | struct nameidata *nd) | 756 | struct nameidata *nd) |
757 | { | 757 | { |
758 | struct dentry *ret = NULL; | 758 | struct dentry *ret = NULL; |
759 | struct sysfs_dirent * parent_sd = dentry->d_parent->d_fsdata; | 759 | struct sysfs_dirent *parent_sd = dentry->d_parent->d_fsdata; |
760 | struct sysfs_dirent * sd; | 760 | struct sysfs_dirent *sd; |
761 | struct bin_attribute *bin_attr; | 761 | struct bin_attribute *bin_attr; |
762 | struct inode *inode; | 762 | struct inode *inode; |
763 | int found = 0; | ||
764 | 763 | ||
765 | mutex_lock(&sysfs_mutex); | 764 | mutex_lock(&sysfs_mutex); |
766 | 765 | ||
767 | for (sd = parent_sd->s_children; sd; sd = sd->s_sibling) { | 766 | for (sd = parent_sd->s_children; sd; sd = sd->s_sibling) |
768 | if (sysfs_type(sd) && | 767 | if (sysfs_type(sd) && !strcmp(sd->s_name, dentry->d_name.name)) |
769 | !strcmp(sd->s_name, dentry->d_name.name)) { | ||
770 | found = 1; | ||
771 | break; | 768 | break; |
772 | } | ||
773 | } | ||
774 | 769 | ||
775 | /* no such entry */ | 770 | /* no such entry */ |
776 | if (!found) | 771 | if (!sd) |
777 | goto out_unlock; | 772 | goto out_unlock; |
778 | 773 | ||
779 | /* attach dentry and inode */ | 774 | /* attach dentry and inode */ |