linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] v4l: video-buf update
@ 2005-01-20 15:26 Gerd Knorr
  0 siblings, 0 replies; 2+ messages in thread
From: Gerd Knorr @ 2005-01-20 15:26 UTC (permalink / raw)
  To: Andrew Morton, Linux Kernel Mailing List

- Fix a memory leak in video-buf.c
- Small update for the video-buf-dvb.c module.

Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
---
 drivers/media/video/video-buf-dvb.c |   11 +++++++----
 drivers/media/video/video-buf.c     |    4 +++-
 include/media/video-buf-dvb.h       |    4 +++-
 3 files changed, 13 insertions(+), 6 deletions(-)

Index: linux-2.6.10/drivers/media/video/video-buf.c
===================================================================
--- linux-2.6.10.orig/drivers/media/video/video-buf.c	2004-12-29 23:56:51.000000000 +0100
+++ linux-2.6.10/drivers/media/video/video-buf.c	2005-01-07 16:46:42.650627658 +0100
@@ -1,5 +1,5 @@
 /*
- * $Id: video-buf.c,v 1.15 2004/11/07 14:45:00 kraxel Exp $
+ * $Id: video-buf.c,v 1.17 2004/12/10 12:33:40 kraxel Exp $
  *
  * generic helper functions for video4linux capture buffers, to handle
  * memory management and PCI DMA.  Right now bttv + saa7134 use it.
@@ -20,6 +20,7 @@
 
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/vmalloc.h>
 #include <linux/pagemap.h>
 #include <linux/slab.h>
@@ -892,6 +893,7 @@ void videobuf_read_stop(struct videobuf_
 	int i;
 
 	videobuf_queue_cancel(q);
+	videobuf_mmap_free(q);
 	INIT_LIST_HEAD(&q->stream);
 	for (i = 0; i < VIDEO_MAX_FRAME; i++) {
 		if (NULL == q->bufs[i])
Index: linux-2.6.10/drivers/media/video/video-buf-dvb.c
===================================================================
--- linux-2.6.10.orig/drivers/media/video/video-buf-dvb.c	2004-12-29 23:55:09.000000000 +0100
+++ linux-2.6.10/drivers/media/video/video-buf-dvb.c	2005-01-07 16:41:25.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- * $Id: video-buf-dvb.c,v 1.5 2004/11/07 13:17:15 kraxel Exp $
+ * $Id: video-buf-dvb.c,v 1.7 2004/12/09 12:51:35 kraxel Exp $
  *
  * some helper function for simple DVB cards which simply DMA the
  * complete transport stream and let the computer sort everything else
@@ -35,7 +35,7 @@ module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug,"enable debug messages");
 
 #define dprintk(fmt, arg...)	if (debug)			\
-	printk(KERN_DEBUG "%s/dvb: " fmt, dvb->name, ## arg)
+	printk(KERN_DEBUG "%s/dvb: " fmt, dvb->name , ## arg)
 
 /* ------------------------------------------------------------------ */
 
@@ -134,19 +134,22 @@ static int videobuf_dvb_stop_feed(struct
 
 /* ------------------------------------------------------------------ */
 
-int videobuf_dvb_register(struct videobuf_dvb *dvb)
+int videobuf_dvb_register(struct videobuf_dvb *dvb,
+			  struct module *module,
+			  void *adapter_priv)
 {
 	int result;
 
 	init_MUTEX(&dvb->lock);
 
 	/* register adapter */
-	result = dvb_register_adapter(&dvb->adapter, dvb->name, THIS_MODULE);
+	result = dvb_register_adapter(&dvb->adapter, dvb->name, module);
 	if (result < 0) {
 		printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n",
 		       dvb->name, result);
 		goto fail_adapter;
 	}
+	dvb->adapter->priv = adapter_priv;
 
 	/* register frontend */
 	result = dvb_register_frontend(dvb->adapter, dvb->frontend);
Index: linux-2.6.10/include/media/video-buf-dvb.h
===================================================================
--- linux-2.6.10.orig/include/media/video-buf-dvb.h	2004-12-29 23:58:34.000000000 +0100
+++ linux-2.6.10/include/media/video-buf-dvb.h	2005-01-07 16:41:25.000000000 +0100
@@ -24,7 +24,9 @@ struct videobuf_dvb {
 	struct dvb_net             net;
 };
 
-int videobuf_dvb_register(struct videobuf_dvb *dvb);
+int videobuf_dvb_register(struct videobuf_dvb *dvb,
+			  struct module *module,
+			  void *adapter_priv);
 void videobuf_dvb_unregister(struct videobuf_dvb *dvb);
 
 /*

-- 
#define printk(args...) fprintf(stderr, ## args)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [patch] v4l: video-buf update
@ 2005-03-08 10:44 Gerd Knorr
  0 siblings, 0 replies; 2+ messages in thread
From: Gerd Knorr @ 2005-03-08 10:44 UTC (permalink / raw)
  To: Andrew Morton, Linux Kernel Mailing List

Bugfix: catch pci_map_sg() failures.

Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
---
 drivers/media/video/video-buf.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff -u linux-2.6.11/drivers/media/video/video-buf.c linux/drivers/media/video/video-buf.c
--- linux-2.6.11/drivers/media/video/video-buf.c	2005-03-07 10:13:55.000000000 +0100
+++ linux/drivers/media/video/video-buf.c	2005-03-07 16:38:38.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- * $Id: video-buf.c,v 1.17 2004/12/10 12:33:40 kraxel Exp $
+ * $Id: video-buf.c,v 1.18 2005/02/24 13:32:30 kraxel Exp $
  *
  * generic helper functions for video4linux capture buffers, to handle
  * memory management and PCI DMA.  Right now bttv + saa7134 use it.
@@ -217,9 +217,18 @@
 		return -ENOMEM;
 	}
 
-	if (!dma->bus_addr)
+	if (!dma->bus_addr) {
 		dma->sglen = pci_map_sg(dev,dma->sglist,dma->nr_pages,
 					dma->direction);
+		if (0 == dma->sglen) {
+			printk(KERN_WARNING
+			       "%s: pci_map_sg failed\n",__FUNCTION__);
+			kfree(dma->sglist);
+			dma->sglist = NULL;
+			dma->sglen = 0;
+			return -EIO;
+		}
+	}
 	return 0;
 }
 

-- 
#define printk(args...) fprintf(stderr, ## args)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-03-08 10:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-20 15:26 [patch] v4l: video-buf update Gerd Knorr
2005-03-08 10:44 Gerd Knorr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).