All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Timur Tabi <timur@freescale.com>
Cc: dan.j.williams@intel.com, haavard.skinnemoen@atmel.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmatest: properly handle duplicate DMA channels
Date: Fri, 19 Sep 2008 16:31:45 -0700	[thread overview]
Message-ID: <20080919163145.de9866ac.akpm@linux-foundation.org> (raw)
In-Reply-To: <1221751279-24936-1-git-send-email-timur@freescale.com>

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;
_


  parent reply	other threads:[~2008-09-19 23:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 15:21 [PATCH] dmatest: properly handle duplicate DMA channels Timur Tabi
2008-09-18 15:32 ` Haavard Skinnemoen
2008-09-18 15:34   ` Timur Tabi
2008-09-18 15:48     ` Haavard Skinnemoen
2008-09-19 23:31 ` Andrew Morton [this message]
2008-09-20 12:42   ` Haavard Skinnemoen
2008-09-20 21:40   ` Dan Williams
2008-09-20 22:20     ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080919163145.de9866ac.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=haavard.skinnemoen@atmel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=timur@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.