diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 337162935d2173964538a190b7ed6e8433823f35..b197016bbfbe6ec026118c3fcd5cd10be16bc85f 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -678,8 +678,10 @@ static struct dentry * sysfs_lookup(struct inode *dir, struct dentry *dentry, sd = sysfs_find_dirent(parent_sd, dentry->d_name.name); /* no such entry */ - if (!sd) + if (!sd) { + ret = ERR_PTR(-ENOENT); goto out_unlock; + } /* attach dentry and inode */ inode = sysfs_get_inode(sd);