diff options
-rw-r--r-- | net/irda/irlap.c | 26 | ||||
-rw-r--r-- | net/irda/irlmp.c | 21 | ||||
-rw-r--r-- | net/irda/irttp.c | 21 |
3 files changed, 8 insertions, 60 deletions
diff --git a/net/irda/irlap.c b/net/irda/irlap.c index 3d76aafdb2e5..f3236acc8d22 100644 --- a/net/irda/irlap.c +++ b/net/irda/irlap.c | |||
@@ -1219,29 +1219,11 @@ static const struct seq_operations irlap_seq_ops = { | |||
1219 | 1219 | ||
1220 | static int irlap_seq_open(struct inode *inode, struct file *file) | 1220 | static int irlap_seq_open(struct inode *inode, struct file *file) |
1221 | { | 1221 | { |
1222 | struct seq_file *seq; | 1222 | if (irlap == NULL) |
1223 | int rc = -ENOMEM; | 1223 | return -EINVAL; |
1224 | struct irlap_iter_state *s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
1225 | 1224 | ||
1226 | if (!s) | 1225 | return seq_open_private(file, &irlap_seq_ops, |
1227 | goto out; | 1226 | sizeof(struct irlap_iter_state)); |
1228 | |||
1229 | if (irlap == NULL) { | ||
1230 | rc = -EINVAL; | ||
1231 | goto out_kfree; | ||
1232 | } | ||
1233 | |||
1234 | rc = seq_open(file, &irlap_seq_ops); | ||
1235 | if (rc) | ||
1236 | goto out_kfree; | ||
1237 | |||
1238 | seq = file->private_data; | ||
1239 | seq->private = s; | ||
1240 | out: | ||
1241 | return rc; | ||
1242 | out_kfree: | ||
1243 | kfree(s); | ||
1244 | goto out; | ||
1245 | } | 1227 | } |
1246 | 1228 | ||
1247 | const struct file_operations irlap_seq_fops = { | 1229 | const struct file_operations irlap_seq_fops = { |
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 7efa930ed684..7db92ced2c02 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c | |||
@@ -2003,27 +2003,10 @@ static const struct seq_operations irlmp_seq_ops = { | |||
2003 | 2003 | ||
2004 | static int irlmp_seq_open(struct inode *inode, struct file *file) | 2004 | static int irlmp_seq_open(struct inode *inode, struct file *file) |
2005 | { | 2005 | { |
2006 | struct seq_file *seq; | ||
2007 | int rc = -ENOMEM; | ||
2008 | struct irlmp_iter_state *s; | ||
2009 | |||
2010 | IRDA_ASSERT(irlmp != NULL, return -EINVAL;); | 2006 | IRDA_ASSERT(irlmp != NULL, return -EINVAL;); |
2011 | 2007 | ||
2012 | s = kmalloc(sizeof(*s), GFP_KERNEL); | 2008 | return seq_open_private(file, &irlmp_seq_ops, |
2013 | if (!s) | 2009 | sizeof(struct irlmp_iter_state)); |
2014 | goto out; | ||
2015 | |||
2016 | rc = seq_open(file, &irlmp_seq_ops); | ||
2017 | if (rc) | ||
2018 | goto out_kfree; | ||
2019 | |||
2020 | seq = file->private_data; | ||
2021 | seq->private = s; | ||
2022 | out: | ||
2023 | return rc; | ||
2024 | out_kfree: | ||
2025 | kfree(s); | ||
2026 | goto out; | ||
2027 | } | 2010 | } |
2028 | 2011 | ||
2029 | const struct file_operations irlmp_seq_fops = { | 2012 | const struct file_operations irlmp_seq_fops = { |
diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 3d7ab03fb131..1311976c9dfe 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c | |||
@@ -1884,25 +1884,8 @@ static const struct seq_operations irttp_seq_ops = { | |||
1884 | 1884 | ||
1885 | static int irttp_seq_open(struct inode *inode, struct file *file) | 1885 | static int irttp_seq_open(struct inode *inode, struct file *file) |
1886 | { | 1886 | { |
1887 | struct seq_file *seq; | 1887 | return seq_open_private(file, &irttp_seq_ops, |
1888 | int rc = -ENOMEM; | 1888 | sizeof(struct irttp_iter_state)); |
1889 | struct irttp_iter_state *s; | ||
1890 | |||
1891 | s = kzalloc(sizeof(*s), GFP_KERNEL); | ||
1892 | if (!s) | ||
1893 | goto out; | ||
1894 | |||
1895 | rc = seq_open(file, &irttp_seq_ops); | ||
1896 | if (rc) | ||
1897 | goto out_kfree; | ||
1898 | |||
1899 | seq = file->private_data; | ||
1900 | seq->private = s; | ||
1901 | out: | ||
1902 | return rc; | ||
1903 | out_kfree: | ||
1904 | kfree(s); | ||
1905 | goto out; | ||
1906 | } | 1889 | } |
1907 | 1890 | ||
1908 | const struct file_operations irttp_seq_fops = { | 1891 | const struct file_operations irttp_seq_fops = { |