Skip to contentSkip to conversation

kfifo: fix DMA sample driver

PATCH In review Ira W. Snyder 1 participant 2 messages Aug 13, 2010 Kfifo

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kfifo: fix DMA sample driver

The kfifo DMA sample driver is broken. It does not properly initialize the scatterlist, and therefore causes a kernel BUG with CONFIG_DEBUG_SG=y.

---
 samples/kfifo/dma-example.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
samples/kfifo/dma-example.c +3 -0
index b9482c2..baa5060 100644
@@ -45,6 +45,9 @@ static int __init example_init(void)
 
 	printk(KERN_INFO "queue len: %u\n", kfifo_len(&fifo));
 
+	/* initialize scatterlist */
+	sg_init_table(sg, ARRAY_SIZE(sg));
+
 	ret = kfifo_dma_in_prepare(&fifo, sg, ARRAY_SIZE(sg), FIFO_SIZE);
 	printk(KERN_INFO "DMA sgl entries: %d\n", ret);
 
Signature · 1 line
1.7.1
#1 lore raw
Quoted 6 lines · Ira W. Snyder

The kfifo DMA sample driver is broken. It does not properly initialize the scatterlist, and therefore causes a kernel BUG with CONFIG_DEBUG_SG=y.

---

Whoops, forgot to CC Stefani Seibold.

Quoted 20 lines
 samples/kfifo/dma-example.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
samples/kfifo/dma-example.c +3 -0
index b9482c2..baa5060 100644
@@ -45,6 +45,9 @@ static int __init example_init(void)
 
 	printk(KERN_INFO "queue len: %u\n", kfifo_len(&fifo));
 
+	/* initialize scatterlist */
+	sg_init_table(sg, ARRAY_SIZE(sg));
+
 	ret = kfifo_dma_in_prepare(&fifo, sg, ARRAY_SIZE(sg), FIFO_SIZE);
 	printk(KERN_INFO "DMA sgl entries: %d\n", ret);
 
Signature · 1 line
1.7.1