summaryrefslogtreecommitdiff
path: root/fs/seq_file.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-11-10 01:33:22 +0300
committerSteve French <sfrench@us.ibm.com>2005-11-10 01:33:22 +0300
commite82b3aec8d508d2a925a4c766e97f16b7c4dfb1b (patch)
tree69d5685ef0c194f651a03e30bff14628b4d45400 /fs/seq_file.c
parentec58ef03284f0bfa50a04982b74c8c2325a0758e (diff)
parentad8f76be48d817b48222411ae16a7dfe257bdb24 (diff)
downloadlinux-e82b3aec8d508d2a925a4c766e97f16b7c4dfb1b.tar.xz
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'fs/seq_file.c')
-rw-r--r--fs/seq_file.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/seq_file.c b/fs/seq_file.c
index 38ef913767ff..7c40570b71dc 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -28,13 +28,17 @@
*/
int seq_open(struct file *file, struct seq_operations *op)
{
- struct seq_file *p = kmalloc(sizeof(*p), GFP_KERNEL);
- if (!p)
- return -ENOMEM;
+ struct seq_file *p = file->private_data;
+
+ if (!p) {
+ p = kmalloc(sizeof(*p), GFP_KERNEL);
+ if (!p)
+ return -ENOMEM;
+ file->private_data = p;
+ }
memset(p, 0, sizeof(*p));
sema_init(&p->sem, 1);
p->op = op;
- file->private_data = p;
/*
* Wrappers around seq_open(e.g. swaps_open) need to be