Skip to content

Commit 7747807

Browse files
committed
Merge tag 'dmaengine-fix-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine
Pull dmaengine fixes from Vinod Koul: "A bunch of driver fixes for: - ptdma error handling in init - lock fix in at_hdmac - error path and error num fix for sh dma - pm balance fix for stm32" * tag 'dmaengine-fix-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine: dmaengine: shdma: Fix runtime PM imbalance on error dmaengine: sh: rcar-dmac: Check for error num after dma_set_max_seg_size dmaengine: stm32-dmamux: Fix PM disable depth imbalance in stm32_dmamux_probe dmaengine: sh: rcar-dmac: Check for error num after setting mask dmaengine: at_xdmac: Fix missing unlock in at_xdmac_tasklet() dmaengine: ptdma: Fix the error handling path in pt_core_init()
2 parents dacec3e + 455896c commit 7747807

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

drivers/dma/at_xdmac.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,8 +1681,10 @@ static void at_xdmac_tasklet(struct tasklet_struct *t)
16811681
__func__, atchan->irq_status);
16821682

16831683
if (!(atchan->irq_status & AT_XDMAC_CIS_LIS) &&
1684-
!(atchan->irq_status & error_mask))
1684+
!(atchan->irq_status & error_mask)) {
1685+
spin_unlock_irq(&atchan->lock);
16851686
return;
1687+
}
16861688

16871689
if (atchan->irq_status & error_mask)
16881690
at_xdmac_handle_error(atchan);

drivers/dma/ptdma/ptdma-dev.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ int pt_core_init(struct pt_device *pt)
207207
if (!cmd_q->qbase) {
208208
dev_err(dev, "unable to allocate command queue\n");
209209
ret = -ENOMEM;
210-
goto e_dma_alloc;
210+
goto e_destroy_pool;
211211
}
212212

213213
cmd_q->qidx = 0;
@@ -229,8 +229,10 @@ int pt_core_init(struct pt_device *pt)
229229

230230
/* Request an irq */
231231
ret = request_irq(pt->pt_irq, pt_core_irq_handler, 0, dev_name(pt->dev), pt);
232-
if (ret)
233-
goto e_pool;
232+
if (ret) {
233+
dev_err(dev, "unable to allocate an IRQ\n");
234+
goto e_free_dma;
235+
}
234236

235237
/* Update the device registers with queue information. */
236238
cmd_q->qcontrol &= ~CMD_Q_SIZE;
@@ -250,21 +252,20 @@ int pt_core_init(struct pt_device *pt)
250252
/* Register the DMA engine support */
251253
ret = pt_dmaengine_register(pt);
252254
if (ret)
253-
goto e_dmaengine;
255+
goto e_free_irq;
254256

255257
/* Set up debugfs entries */
256258
ptdma_debugfs_setup(pt);
257259

258260
return 0;
259261

260-
e_dmaengine:
262+
e_free_irq:
261263
free_irq(pt->pt_irq, pt);
262264

263-
e_dma_alloc:
265+
e_free_dma:
264266
dma_free_coherent(dev, cmd_q->qsize, cmd_q->qbase, cmd_q->qbase_dma);
265267

266-
e_pool:
267-
dev_err(dev, "unable to allocate an IRQ\n");
268+
e_destroy_pool:
268269
dma_pool_destroy(pt->cmd_q.dma_pool);
269270

270271
return ret;

drivers/dma/sh/rcar-dmac.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,8 +1868,13 @@ static int rcar_dmac_probe(struct platform_device *pdev)
18681868

18691869
dmac->dev = &pdev->dev;
18701870
platform_set_drvdata(pdev, dmac);
1871-
dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK);
1872-
dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40));
1871+
ret = dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK);
1872+
if (ret)
1873+
return ret;
1874+
1875+
ret = dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40));
1876+
if (ret)
1877+
return ret;
18731878

18741879
ret = rcar_dmac_parse_of(&pdev->dev, dmac);
18751880
if (ret < 0)

drivers/dma/sh/shdma-base.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx)
115115
ret = pm_runtime_get(schan->dev);
116116

117117
spin_unlock_irq(&schan->chan_lock);
118-
if (ret < 0)
118+
if (ret < 0) {
119119
dev_err(schan->dev, "%s(): GET = %d\n", __func__, ret);
120+
pm_runtime_put(schan->dev);
121+
}
120122

121123
pm_runtime_barrier(schan->dev);
122124

drivers/dma/stm32-dmamux.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,12 @@ static int stm32_dmamux_probe(struct platform_device *pdev)
292292
ret = of_dma_router_register(node, stm32_dmamux_route_allocate,
293293
&stm32_dmamux->dmarouter);
294294
if (ret)
295-
goto err_clk;
295+
goto pm_disable;
296296

297297
return 0;
298298

299+
pm_disable:
300+
pm_runtime_disable(&pdev->dev);
299301
err_clk:
300302
clk_disable_unprepare(stm32_dmamux->clk);
301303

0 commit comments

Comments
 (0)