diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-08 15:59:45 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-01-08 20:18:50 -0500 |
commit | 87da5b3264c8514b85c6c6e8ef51b9440eee2030 (patch) | |
tree | 73ba93b1d0e499d21b78ef9cf8e824c1b42c2506 | |
parent | 5b5f9560354dc5a3a27ce57a86aec6b98531ee21 (diff) |
... and the same for gadgetfs
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/usb/gadget/inode.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c index 6ccae2707e59..6b7ea25af0fe 100644 --- a/drivers/usb/gadget/inode.c +++ b/drivers/usb/gadget/inode.c | |||
@@ -2035,7 +2035,6 @@ static int | |||
2035 | gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) | 2035 | gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) |
2036 | { | 2036 | { |
2037 | struct inode *inode; | 2037 | struct inode *inode; |
2038 | struct dentry *d; | ||
2039 | struct dev_data *dev; | 2038 | struct dev_data *dev; |
2040 | 2039 | ||
2041 | if (the_device) | 2040 | if (the_device) |
@@ -2058,24 +2057,27 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) | |||
2058 | NULL, &simple_dir_operations, | 2057 | NULL, &simple_dir_operations, |
2059 | S_IFDIR | S_IRUGO | S_IXUGO); | 2058 | S_IFDIR | S_IRUGO | S_IXUGO); |
2060 | if (!inode) | 2059 | if (!inode) |
2061 | goto enomem0; | 2060 | goto Enomem; |
2062 | inode->i_op = &simple_dir_inode_operations; | 2061 | inode->i_op = &simple_dir_inode_operations; |
2063 | if (!(d = d_alloc_root (inode))) | 2062 | if (!(sb->s_root = d_alloc_root (inode))) { |
2064 | goto enomem1; | 2063 | iput(inode); |
2065 | sb->s_root = d; | 2064 | goto Enomem; |
2065 | } | ||
2066 | 2066 | ||
2067 | /* the ep0 file is named after the controller we expect; | 2067 | /* the ep0 file is named after the controller we expect; |
2068 | * user mode code can use it for sanity checks, like we do. | 2068 | * user mode code can use it for sanity checks, like we do. |
2069 | */ | 2069 | */ |
2070 | dev = dev_new (); | 2070 | dev = dev_new (); |
2071 | if (!dev) | 2071 | if (!dev) |
2072 | goto enomem2; | 2072 | goto Enomem; |
2073 | 2073 | ||
2074 | dev->sb = sb; | 2074 | dev->sb = sb; |
2075 | if (!gadgetfs_create_file (sb, CHIP, | 2075 | if (!gadgetfs_create_file (sb, CHIP, |
2076 | dev, &dev_init_operations, | 2076 | dev, &dev_init_operations, |
2077 | &dev->dentry)) | 2077 | &dev->dentry)) { |
2078 | goto enomem3; | 2078 | put_dev(dev); |
2079 | goto Enomem; | ||
2080 | } | ||
2079 | 2081 | ||
2080 | /* other endpoint files are available after hardware setup, | 2082 | /* other endpoint files are available after hardware setup, |
2081 | * from binding to a controller. | 2083 | * from binding to a controller. |
@@ -2083,13 +2085,7 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent) | |||
2083 | the_device = dev; | 2085 | the_device = dev; |
2084 | return 0; | 2086 | return 0; |
2085 | 2087 | ||
2086 | enomem3: | 2088 | Enomem: |
2087 | put_dev (dev); | ||
2088 | enomem2: | ||
2089 | dput (d); | ||
2090 | enomem1: | ||
2091 | iput (inode); | ||
2092 | enomem0: | ||
2093 | return -ENOMEM; | 2089 | return -ENOMEM; |
2094 | } | 2090 | } |
2095 | 2091 | ||