diff options
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r-- | mm/vmalloc.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 2b0aa5486092..90520af7f186 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -2646,21 +2646,11 @@ static const struct seq_operations vmalloc_op = { | |||
2646 | 2646 | ||
2647 | static int vmalloc_open(struct inode *inode, struct file *file) | 2647 | static int vmalloc_open(struct inode *inode, struct file *file) |
2648 | { | 2648 | { |
2649 | unsigned int *ptr = NULL; | 2649 | if (IS_ENABLED(CONFIG_NUMA)) |
2650 | int ret; | 2650 | return seq_open_private(file, &vmalloc_op, |
2651 | 2651 | nr_node_ids * sizeof(unsigned int)); | |
2652 | if (IS_ENABLED(CONFIG_NUMA)) { | 2652 | else |
2653 | ptr = kmalloc(nr_node_ids * sizeof(unsigned int), GFP_KERNEL); | 2653 | return seq_open(file, &vmalloc_op); |
2654 | if (ptr == NULL) | ||
2655 | return -ENOMEM; | ||
2656 | } | ||
2657 | ret = seq_open(file, &vmalloc_op); | ||
2658 | if (!ret) { | ||
2659 | struct seq_file *m = file->private_data; | ||
2660 | m->private = ptr; | ||
2661 | } else | ||
2662 | kfree(ptr); | ||
2663 | return ret; | ||
2664 | } | 2654 | } |
2665 | 2655 | ||
2666 | static const struct file_operations proc_vmalloc_operations = { | 2656 | static const struct file_operations proc_vmalloc_operations = { |