Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7452584

Browse files
committed
dmaengine: rcar-dmac: Fix release resources after interrupt process
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]>
1 parent 94794e4 commit 7452584

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

drivers/dma/sh/rcar-dmac.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,24 @@ static int rcar_dmac_chan_terminate_all(struct dma_chan *chan)
12631263
return 0;
12641264
}
12651265

1266+
static void rcar_dmac_synchronize(struct dma_chan *chan)
1267+
{
1268+
struct rcar_dmac_chan *rchan = to_rcar_dmac_chan(chan);
1269+
struct rcar_dmac *dmac = to_rcar_dmac(chan->device);
1270+
struct platform_device *pdev = to_platform_device(dmac->dev);
1271+
int irq;
1272+
char pdev_irqname[5];
1273+
1274+
sprintf(pdev_irqname, "ch%u", rchan->index);
1275+
irq = platform_get_irq_byname(pdev, pdev_irqname);
1276+
if (irq < 0) {
1277+
dev_err(dmac->dev, "no IRQ specified for channel %u\n",
1278+
rchan->index);
1279+
return;
1280+
}
1281+
synchronize_irq(irq);
1282+
}
1283+
12661284
static unsigned int rcar_dmac_chan_get_residue(struct rcar_dmac_chan *chan,
12671285
dma_cookie_t cookie)
12681286
{
@@ -1901,6 +1919,7 @@ static int rcar_dmac_probe(struct platform_device *pdev)
19011919
engine->device_config = rcar_dmac_device_config;
19021920
engine->device_pause = rcar_dmac_chan_pause;
19031921
engine->device_terminate_all = rcar_dmac_chan_terminate_all;
1922+
engine->device_synchronize = rcar_dmac_synchronize;
19041923
engine->device_tx_status = rcar_dmac_tx_status;
19051924
engine->device_issue_pending = rcar_dmac_issue_pending;
19061925

0 commit comments

Comments
 (0)