diff options
Diffstat (limited to 'fs/seq_file.c')
-rw-r--r-- | fs/seq_file.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/seq_file.c b/fs/seq_file.c index 555f82155be8..5f163c6c821c 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -51,15 +51,16 @@ static void *seq_buf_alloc(unsigned long size) */ int seq_open(struct file *file, const struct seq_operations *op) { - struct seq_file *p = file->private_data; + struct seq_file *p; + + WARN_ON(file->private_data); + + p = kzalloc(sizeof(*p), GFP_KERNEL); + if (!p) + return -ENOMEM; + + file->private_data = p; - if (!p) { - p = kmalloc(sizeof(*p), GFP_KERNEL); - if (!p) - return -ENOMEM; - file->private_data = p; - } - memset(p, 0, sizeof(*p)); mutex_init(&p->lock); p->op = op; #ifdef CONFIG_USER_NS |