diff options
Diffstat (limited to 'fs/sysfs/symlink.c')
-rw-r--r-- | fs/sysfs/symlink.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c index e38d6338a20d..fe23f47f6e43 100644 --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c | |||
@@ -82,12 +82,13 @@ exit1: | |||
82 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name) | 82 | int sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name) |
83 | { | 83 | { |
84 | struct dentry * dentry = kobj->dentry; | 84 | struct dentry * dentry = kobj->dentry; |
85 | int error = 0; | 85 | int error = -EEXIST; |
86 | 86 | ||
87 | BUG_ON(!kobj || !kobj->dentry || !name); | 87 | BUG_ON(!kobj || !kobj->dentry || !name); |
88 | 88 | ||
89 | mutex_lock(&dentry->d_inode->i_mutex); | 89 | mutex_lock(&dentry->d_inode->i_mutex); |
90 | error = sysfs_add_link(dentry, name, target); | 90 | if (!sysfs_dirent_exist(dentry->d_fsdata, name)) |
91 | error = sysfs_add_link(dentry, name, target); | ||
91 | mutex_unlock(&dentry->d_inode->i_mutex); | 92 | mutex_unlock(&dentry->d_inode->i_mutex); |
92 | return error; | 93 | return error; |
93 | } | 94 | } |