lkml.org 
[lkml]   [2004]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] cleanup single_open usage in dma.c
The attached patch lets the seq_file api take care of buffer allocation 
instead of doing it by hand.

-Jeff
diff -ur linux-2.6.1-mm3/kernel/dma.c linux-2.6.1-mm3-dma-proc/kernel/dma.c
--- linux-2.6.1-mm3/kernel/dma.c 2004-01-09 01:59:10.000000000 -0500
+++ linux-2.6.1-mm3-dma-proc/kernel/dma.c 2004-01-15 22:10:04.000000000 -0500
@@ -136,20 +136,7 @@

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 = {
\
 
 \ /
  Last update: 2005-03-22 14:00    [W:0.024 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site