Commit 87da5b32 authored by Al Viro's avatar Al Viro

... and the same for gadgetfs

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 5b5f9560
...@@ -2035,7 +2035,6 @@ static int ...@@ -2035,7 +2035,6 @@ static int
gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
{ {
struct inode *inode; struct inode *inode;
struct dentry *d;
struct dev_data *dev; struct dev_data *dev;
if (the_device) if (the_device)
...@@ -2058,24 +2057,27 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) ...@@ -2058,24 +2057,27 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
NULL, &simple_dir_operations, NULL, &simple_dir_operations,
S_IFDIR | S_IRUGO | S_IXUGO); S_IFDIR | S_IRUGO | S_IXUGO);
if (!inode) if (!inode)
goto enomem0; goto Enomem;
inode->i_op = &simple_dir_inode_operations; inode->i_op = &simple_dir_inode_operations;
if (!(d = d_alloc_root (inode))) if (!(sb->s_root = d_alloc_root (inode))) {
goto enomem1; iput(inode);
sb->s_root = d; goto Enomem;
}
/* the ep0 file is named after the controller we expect; /* the ep0 file is named after the controller we expect;
* user mode code can use it for sanity checks, like we do. * user mode code can use it for sanity checks, like we do.
*/ */
dev = dev_new (); dev = dev_new ();
if (!dev) if (!dev)
goto enomem2; goto Enomem;
dev->sb = sb; dev->sb = sb;
if (!gadgetfs_create_file (sb, CHIP, if (!gadgetfs_create_file (sb, CHIP,
dev, &dev_init_operations, dev, &dev_init_operations,
&dev->dentry)) &dev->dentry)) {
goto enomem3; put_dev(dev);
goto Enomem;
}
/* other endpoint files are available after hardware setup, /* other endpoint files are available after hardware setup,
* from binding to a controller. * from binding to a controller.
...@@ -2083,13 +2085,7 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) ...@@ -2083,13 +2085,7 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
the_device = dev; the_device = dev;
return 0; return 0;
enomem3: Enomem:
put_dev (dev);
enomem2:
dput (d);
enomem1:
iput (inode);
enomem0:
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment