mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
configfs: configfs_create() init callback is never NULL and it never fails
... so make it return void and drop the check for it being non-NULL Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
dbca51ddb0
commit
c88b1e70ae
@ -69,7 +69,7 @@ extern struct kmem_cache *configfs_dir_cachep;
|
||||
extern int configfs_is_root(struct config_item *item);
|
||||
|
||||
extern struct inode * configfs_new_inode(umode_t mode, struct configfs_dirent *, struct super_block *);
|
||||
extern int configfs_create(struct dentry *, umode_t mode, int (*init)(struct inode *));
|
||||
extern int configfs_create(struct dentry *, umode_t mode, void (*init)(struct inode *));
|
||||
|
||||
extern int configfs_create_file(struct config_item *, const struct configfs_attribute *);
|
||||
extern int configfs_make_dirent(struct configfs_dirent *,
|
||||
|
@ -240,27 +240,24 @@ int configfs_make_dirent(struct configfs_dirent * parent_sd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init_dir(struct inode * inode)
|
||||
static void init_dir(struct inode * inode)
|
||||
{
|
||||
inode->i_op = &configfs_dir_inode_operations;
|
||||
inode->i_fop = &configfs_dir_operations;
|
||||
|
||||
/* directory inodes start off with i_nlink == 2 (for "." entry) */
|
||||
inc_nlink(inode);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int configfs_init_file(struct inode * inode)
|
||||
static void configfs_init_file(struct inode * inode)
|
||||
{
|
||||
inode->i_size = PAGE_SIZE;
|
||||
inode->i_fop = &configfs_file_operations;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int init_symlink(struct inode * inode)
|
||||
static void init_symlink(struct inode * inode)
|
||||
{
|
||||
inode->i_op = &configfs_symlink_inode_operations;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int create_dir(struct config_item *k, struct dentry *d)
|
||||
|
@ -176,7 +176,7 @@ static void configfs_set_inode_lock_class(struct configfs_dirent *sd,
|
||||
|
||||
#endif /* CONFIG_LOCKDEP */
|
||||
|
||||
int configfs_create(struct dentry * dentry, umode_t mode, int (*init)(struct inode *))
|
||||
int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct inode *))
|
||||
{
|
||||
int error = 0;
|
||||
struct inode *inode = NULL;
|
||||
@ -198,13 +198,7 @@ int configfs_create(struct dentry * dentry, umode_t mode, int (*init)(struct ino
|
||||
p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME;
|
||||
configfs_set_inode_lock_class(sd, inode);
|
||||
|
||||
if (init) {
|
||||
error = init(inode);
|
||||
if (error) {
|
||||
iput(inode);
|
||||
return error;
|
||||
}
|
||||
}
|
||||
init(inode);
|
||||
d_instantiate(dentry, inode);
|
||||
if (S_ISDIR(mode) || S_ISLNK(mode))
|
||||
dget(dentry); /* pin link and directory dentries in core */
|
||||
|
Loading…
Reference in New Issue
Block a user