hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
....@@ -551,6 +551,11 @@
551551
552552 /* The bad descriptor currently is in the head of vc list */
553553 vd = vchan_next_desc(&chan->vc);
554
+ if (!vd) {
555
+ dev_err(chan2dev(chan), "BUG: %s, IRQ with no descriptors\n",
556
+ axi_chan_name(chan));
557
+ goto out;
558
+ }
554559 /* Remove the completed descriptor from issued list */
555560 list_del(&vd->node);
556561
....@@ -565,6 +570,7 @@
565570 /* Try to restart the controller */
566571 axi_chan_start_first_queued(chan);
567572
573
+out:
568574 spin_unlock_irqrestore(&chan->vc.lock, flags);
569575 }
570576
....@@ -636,13 +642,9 @@
636642
637643 vchan_get_all_descriptors(&chan->vc, &head);
638644
639
- /*
640
- * As vchan_dma_desc_free_list can access to desc_allocated list
641
- * we need to call it in vc.lock context.
642
- */
643
- vchan_dma_desc_free_list(&chan->vc, &head);
644
-
645645 spin_unlock_irqrestore(&chan->vc.lock, flags);
646
+
647
+ vchan_dma_desc_free_list(&chan->vc, &head);
646648
647649 dev_vdbg(dchan2dev(dchan), "terminated: %s\n", axi_chan_name(chan));
648650
....@@ -935,7 +937,7 @@
935937
936938 pm_runtime_put(chip->dev);
937939
938
- ret = dma_async_device_register(&dw->dma);
940
+ ret = dmaenginem_async_device_register(&dw->dma);
939941 if (ret)
940942 goto err_pm_disable;
941943
....@@ -977,8 +979,6 @@
977979 list_del(&chan->vc.chan.device_node);
978980 tasklet_kill(&chan->vc.task);
979981 }
980
-
981
- dma_async_device_unregister(&dw->dma);
982982
983983 return 0;
984984 }