diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/seq_file.c | 12 |
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 @@ | |||
28 | */ | 28 | */ |
29 | int seq_open(struct file *file, struct seq_operations *op) | 29 | int seq_open(struct file *file, struct seq_operations *op) |
30 | { | 30 | { |
31 | struct seq_file *p = kmalloc(sizeof(*p), GFP_KERNEL); | 31 | struct seq_file *p = file->private_data; |
32 | if (!p) | 32 | |
33 | return -ENOMEM; | 33 | if (!p) { |
34 | p = kmalloc(sizeof(*p), GFP_KERNEL); | ||
35 | if (!p) | ||
36 | return -ENOMEM; | ||
37 | file->private_data = p; | ||
38 | } | ||
34 | memset(p, 0, sizeof(*p)); | 39 | memset(p, 0, sizeof(*p)); |
35 | sema_init(&p->sem, 1); | 40 | sema_init(&p->sem, 1); |
36 | p->op = op; | 41 | p->op = op; |
37 | file->private_data = p; | ||
38 | 42 | ||
39 | /* | 43 | /* |
40 | * Wrappers around seq_open(e.g. swaps_open) need to be | 44 | * Wrappers around seq_open(e.g. swaps_open) need to be |