Skip to content

Commit

Permalink
dmaengine: rcar-dmac: Fix release resources after interrupt process
Browse files Browse the repository at this point in the history
This patch fixes the problem that occasionally released resources
before the end of interrupt processing.

[   58.156412] Unable to handle kernel NULL pointer dereference at virtual
 address 00000000
[   58.166155] pgd = ffff8006f78b0000
[   58.169822] [00000000] *pgd=000000073773b003 , *pud=0000000737c70003 ,
 *pmd=0000000000000000
[   58.179738]
[   58.181548] Internal error: Oops: 96000046 [#1] PREEMPT SMP
[   58.187484] Modules linked in:
[   58.190919] CPU: 0 PID: 2898 Comm: dma_ioctl Not tainted 4.9.0-00002-g501
07f2-dirty xen-troops#147
[   58.199438] Hardware name: Renesas Salvator-X board based on r8a7795 (DT)
[   58.206680] task: ffff8006f77b1900 task.stack: ffff8006f7bd4000
[   58.213090] PC is at rcar_dmac_chan_prep_sg+0xa4/0x3f0
[   58.218725] LR is at rcar_dmac_chan_prep_sg+0x6c/0x3f0

Signed-off-by: Hiroyuki Yokoyama <[email protected]>
  • Loading branch information
h-yokoya committed Mar 24, 2017
1 parent 94794e4 commit 7452584
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/dma/sh/rcar-dmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,24 @@ static int rcar_dmac_chan_terminate_all(struct dma_chan *chan)
return 0;
}

static void rcar_dmac_synchronize(struct dma_chan *chan)
{
struct rcar_dmac_chan *rchan = to_rcar_dmac_chan(chan);
struct rcar_dmac *dmac = to_rcar_dmac(chan->device);
struct platform_device *pdev = to_platform_device(dmac->dev);
int irq;
char pdev_irqname[5];

sprintf(pdev_irqname, "ch%u", rchan->index);
irq = platform_get_irq_byname(pdev, pdev_irqname);
if (irq < 0) {
dev_err(dmac->dev, "no IRQ specified for channel %u\n",
rchan->index);
return;
}
synchronize_irq(irq);
}

static unsigned int rcar_dmac_chan_get_residue(struct rcar_dmac_chan *chan,
dma_cookie_t cookie)
{
Expand Down Expand Up @@ -1901,6 +1919,7 @@ static int rcar_dmac_probe(struct platform_device *pdev)
engine->device_config = rcar_dmac_device_config;
engine->device_pause = rcar_dmac_chan_pause;
engine->device_terminate_all = rcar_dmac_chan_terminate_all;
engine->device_synchronize = rcar_dmac_synchronize;
engine->device_tx_status = rcar_dmac_tx_status;
engine->device_issue_pending = rcar_dmac_issue_pending;

Expand Down

0 comments on commit 7452584

Please sign in to comment.