|
@@ -227,12 +227,16 @@ void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent)
|
|
|
void sysfs_hash_and_remove(struct dentry * dir, const char * name)
|
|
|
{
|
|
|
struct sysfs_dirent * sd;
|
|
|
- struct sysfs_dirent * parent_sd = dir->d_fsdata;
|
|
|
+ struct sysfs_dirent * parent_sd;
|
|
|
+
|
|
|
+ if (!dir)
|
|
|
+ return;
|
|
|
|
|
|
if (dir->d_inode == NULL)
|
|
|
/* no inode means this hasn't been made visible yet */
|
|
|
return;
|
|
|
|
|
|
+ parent_sd = dir->d_fsdata;
|
|
|
mutex_lock(&dir->d_inode->i_mutex);
|
|
|
list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
|
|
|
if (!sd->s_element)
|