convert gadgetfs

same as functionfs

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro
2025-03-09 22:56:17 -04:00
parent b65e3b11e9
commit 57db9d428b

View File

@@ -1989,17 +1989,20 @@ static int gadgetfs_create_file (struct super_block *sb, char const *name,
struct dentry *dentry;
struct inode *inode;
dentry = d_alloc_name(sb->s_root, name);
if (!dentry)
return -ENOMEM;
inode = gadgetfs_make_inode (sb, data, fops,
S_IFREG | (default_perm & S_IRWXUGO));
if (!inode) {
dput(dentry);
if (!inode)
return -ENOMEM;
dentry = simple_start_creating(sb->s_root, name);
if (IS_ERR(dentry)) {
iput(inode);
return PTR_ERR(dentry);
}
d_add (dentry, inode);
d_make_persistent(dentry, inode);
simple_done_creating(dentry);
return 0;
}
@@ -2096,7 +2099,7 @@ static void
gadgetfs_kill_sb (struct super_block *sb)
{
mutex_lock(&sb_mutex);
kill_litter_super (sb);
kill_anon_super (sb);
if (the_device) {
put_dev (the_device);
the_device = NULL;