[patch] v4l: video-buf update

From: Gerd Knorr
Date: Tue Mar 08 2005 - 05:50:26 EST


Bugfix: catch pci_map_sg() failures.

Signed-off-by: Gerd Knorr <kraxel@xxxxxxxxxxx>
---
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)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/