mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Ira Snyder <iws@ovro.caltech.edu>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Sosnowski, Maciej" <maciej.sosnowski@intel.com>,
	"leoli@freescale.com" <leoli@freescale.com>,
	"zw@zh-kernel.org" <zw@zh-kernel.org>
Subject: Re: dmaengine: BUG: Unable to handle kernel paging request
Date: Mon, 12 Jan 2009 12:08:38 -0700	[thread overview]
Message-ID: <1231787318.25777.10.camel@dwillia2-linux.ch.intel.com> (raw)
In-Reply-To: <20090112180423.GA2364@ovro.caltech.edu>

On Mon, 2009-01-12 at 11:04 -0700, Ira Snyder wrote:
> Hello all,
> 
> I'm working on a driver that uses DMAEngine. With the recent changes,
> the driver doesn't work anymore.
> 
> I believe I have tracked it down to commit
> 41d5e59c1299f27983977bcfe3b360600996051c, but it could be one of the
> other DMAEngine commits.
> 
> The code that crashes is in mm/dmapool.c, line 178:
> if (list_empty(&dev->dma_pools))
> 
> I distilled the crash down to the following simple driver, which should
> just get a reference to dmaengine, in preparation for acquiring a
> channel to use.

I believe the problem is that the driver uses the channel device value
before it is created.  Prior to this patch the following line in
fsl_dma_chan_probe:

new_fsl_chan->dev = &new_fsl_chan->common.dev

...would retrieve a pointer to the uninitialized struct device in
dma_chan.  The later call to dma_async_device_register in
of_fsl_dma_probe fixed up this uninitialized data.

However, the dmaengine sysfs implementation was fixed to support proper
lifetime rules which means that the current:

new_fsl_chan->dev = &new_fsl_chan->common.dev->device;

...retrieves a NULL pointer because new_fsl_chan->common.dev has not
been allocated at this point.

The following may fix this up...

diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index ca70a21..748e140 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -822,7 +822,7 @@ static int __devinit fsl_dma_chan_probe(struct fsl_dma_device *fdev,
 	 */
 	WARN_ON(fdev->feature != new_fsl_chan->feature);
 
-	new_fsl_chan->dev = &new_fsl_chan->common.dev->device;
+	new_fsl_chan->dev = fdev->dev;
 	new_fsl_chan->reg_base = ioremap(new_fsl_chan->reg.start,
 			new_fsl_chan->reg.end - new_fsl_chan->reg.start + 1);
 



  reply	other threads:[~2009-01-12 19:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-12 18:04 Ira Snyder
2009-01-12 19:08 ` Dan Williams [this message]
2009-01-12 20:44   ` Ira Snyder

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=1231787318.25777.10.camel@dwillia2-linux.ch.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=iws@ovro.caltech.edu \
    --cc=leoli@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.sosnowski@intel.com \
    --cc=zw@zh-kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome