lkml.org 
[lkml]   [2008]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] dmatest: properly handle duplicate DMA channels
On Thu, 18 Sep 2008 10:21:19 -0500
Timur Tabi <timur@freescale.com> wrote:

> --- a/drivers/dma/dmatest.c
> +++ b/drivers/dma/dmatest.c
> @@ -321,10 +321,15 @@ static void dmatest_cleanup_channel(struct dmatest_chan *dtc)
>
> static enum dma_state_client dmatest_add_channel(struct dma_chan *chan)
> {
> - struct dmatest_chan *dtc;
> + struct dmatest_chan *dtc, *_dtc;
> struct dmatest_thread *thread;
> unsigned int i;
>
> + /* Have we already been told about this channel? */
> + list_for_each_entry_safe(dtc, _dtc, &dmatest_channels, node)
> + if (dtc->chan == chan)
> + return DMA_DUP;
> +
> dtc = kmalloc(sizeof(struct dmatest_chan), GFP_ATOMIC);
> if (!dtc) {
> pr_warning("dmatest: No memory for %s\n", chan->dev.bus_id);

hm. A few lines after that GFP_ATOMIC the driver does a GFP_KERNEL
allocation.

One of them is incorrect. The interface is undocumented (natch), but I
assume that GFP_KERNEL is the one to use here.

--- a/drivers/dma/dmatest.c~a
+++ a/drivers/dma/dmatest.c
@@ -330,7 +330,7 @@ static enum dma_state_client dmatest_add
if (dtc->chan == chan)
return DMA_DUP;

- dtc = kmalloc(sizeof(struct dmatest_chan), GFP_ATOMIC);
+ dtc = kmalloc(sizeof(struct dmatest_chan), GFP_KERNEL);
if (!dtc) {
pr_warning("dmatest: No memory for %s\n", chan->dev.bus_id);
return DMA_NAK;
_


\
 
 \ /
  Last update: 2008-09-20 01:35    [W:0.058 / U:0.544 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site