diff options
Diffstat (limited to 'fs/sysfs/inode.c')
-rw-r--r-- | fs/sysfs/inode.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index e2f6ef138d20..1be853706e99 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -275,22 +275,23 @@ void sysfs_drop_dentry(struct sysfs_dirent *sd) | |||
275 | } | 275 | } |
276 | } | 276 | } |
277 | 277 | ||
278 | int sysfs_hash_and_remove(struct dentry * dir, const char * name) | 278 | int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name) |
279 | { | 279 | { |
280 | struct dentry *dir; | ||
280 | struct sysfs_dirent **pos, *sd; | 281 | struct sysfs_dirent **pos, *sd; |
281 | struct sysfs_dirent *parent_sd; | ||
282 | int found = 0; | 282 | int found = 0; |
283 | 283 | ||
284 | if (!dir) | 284 | if (!dir_sd) |
285 | return -ENOENT; | 285 | return -ENOENT; |
286 | 286 | ||
287 | dir = dir_sd->s_dentry; | ||
288 | |||
287 | if (dir->d_inode == NULL) | 289 | if (dir->d_inode == NULL) |
288 | /* no inode means this hasn't been made visible yet */ | 290 | /* no inode means this hasn't been made visible yet */ |
289 | return -ENOENT; | 291 | return -ENOENT; |
290 | 292 | ||
291 | parent_sd = dir->d_fsdata; | ||
292 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); | 293 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); |
293 | for (pos = &parent_sd->s_children; *pos; pos = &(*pos)->s_sibling) { | 294 | for (pos = &dir_sd->s_children; *pos; pos = &(*pos)->s_sibling) { |
294 | sd = *pos; | 295 | sd = *pos; |
295 | 296 | ||
296 | if (!sysfs_type(sd)) | 297 | if (!sysfs_type(sd)) |