Commit 489a867c authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] cleanup single_open usage in dma.c

From: Jeff Muizelaar <muizelaar@rogers.com>

The attached patch lets the seq_file api take care of buffer allocation
instead of doing it by hand.
parent efe067fa
......@@ -136,20 +136,7 @@ static int proc_dma_show(struct seq_file *m, void *v)
static int proc_dma_open(struct inode *inode, struct file *file)
{
char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
struct seq_file *m;
int res;
if (!buf)
return -ENOMEM;
res = single_open(file, proc_dma_show, NULL);
if (!res) {
m = file->private_data;
m->buf = buf;
m->size = PAGE_SIZE;
} else
kfree(buf);
return res;
return single_open(file, proc_dma_show, NULL);
}
static struct file_operations proc_dma_operations = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment