aboutsummaryrefslogtreecommitdiffstats
path: root/net/irda/irlap.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda/irlap.c')
-rw-r--r--net/irda/irlap.c26
1 files changed, 4 insertions, 22 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
1220static int irlap_seq_open(struct inode *inode, struct file *file) 1220static 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;
1240out:
1241 return rc;
1242out_kfree:
1243 kfree(s);
1244 goto out;
1245} 1227}
1246 1228
1247const struct file_operations irlap_seq_fops = { 1229const struct file_operations irlap_seq_fops = {