--- /dev/null
+From 3770d92bd5237d686e49da7b2fb86f53ee6ed259 Mon Sep 17 00:00:00 2001
+From: Michael Walle <michael@walle.cc>
+Date: Thu, 26 May 2022 15:51:11 +0200
+Subject: dmaengine: at_xdma: handle errors of at_xdmac_alloc_desc() correctly
+
+From: Michael Walle <michael@walle.cc>
+
+commit 3770d92bd5237d686e49da7b2fb86f53ee6ed259 upstream.
+
+It seems that it is valid to have less than the requested number of
+descriptors. But what is not valid and leads to subsequent errors is to
+have zero descriptors. In that case, abort the probing.
+
+Fixes: e1f7c9eee707 ("dmaengine: at_xdmac: creation of the atmel eXtended DMA Controller driver")
+Signed-off-by: Michael Walle <michael@walle.cc>
+Link: https://lore.kernel.org/r/20220526135111.1470926-1-michael@walle.cc
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma/at_xdmac.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/dma/at_xdmac.c
++++ b/drivers/dma/at_xdmac.c
+@@ -1893,6 +1893,11 @@ static int at_xdmac_alloc_chan_resources
+ for (i = 0; i < init_nr_desc_per_channel; i++) {
+ desc = at_xdmac_alloc_desc(chan, GFP_KERNEL);
+ if (!desc) {
++ if (i == 0) {
++ dev_warn(chan2dev(chan),
++ "can't allocate any descriptors\n");
++ return -EIO;
++ }
+ dev_warn(chan2dev(chan),
+ "only %d descriptors have been allocated\n", i);
+ break;
--- /dev/null
+From 49db68d45bdcad06e28a420d5d911e4178389666 Mon Sep 17 00:00:00 2001
+From: Emil Renner Berthing <kernel@esmil.dk>
+Date: Mon, 27 Jun 2022 11:09:39 +0200
+Subject: dmaengine: dw-axi-dmac: Fix RMW on channel suspend register
+
+From: Emil Renner Berthing <kernel@esmil.dk>
+
+commit 49db68d45bdcad06e28a420d5d911e4178389666 upstream.
+
+When the DMA is configured for more than 8 channels the bits controlling
+suspend moves to another register. However when adding support for this
+the new register would be completely overwritten in one case and
+overwritten with values from the old register in another case.
+
+Found by comparing the parallel implementation of more than 8 channel
+support for the StarFive JH7100 SoC by Samin.
+
+Fixes: 824351668a41 ("dmaengine: dw-axi-dmac: support DMAX_NUM_CHANNELS > 8")
+Co-developed-by: Samin Guo <samin.guo@starfivetech.com>
+Signed-off-by: Samin Guo <samin.guo@starfivetech.com>
+Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
+Link: https://lore.kernel.org/r/20220627090939.1775717-1-emil.renner.berthing@canonical.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
++++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c
+@@ -1164,8 +1164,9 @@ static int dma_chan_pause(struct dma_cha
+ BIT(chan->id) << DMAC_CHAN_SUSP_WE_SHIFT;
+ axi_dma_iowrite32(chan->chip, DMAC_CHEN, val);
+ } else {
+- val = BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT |
+- BIT(chan->id) << DMAC_CHAN_SUSP2_WE_SHIFT;
++ val = axi_dma_ioread32(chan->chip, DMAC_CHSUSPREG);
++ val |= BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT |
++ BIT(chan->id) << DMAC_CHAN_SUSP2_WE_SHIFT;
+ axi_dma_iowrite32(chan->chip, DMAC_CHSUSPREG, val);
+ }
+
+@@ -1190,12 +1191,13 @@ static inline void axi_chan_resume(struc
+ {
+ u32 val;
+
+- val = axi_dma_ioread32(chan->chip, DMAC_CHEN);
+ if (chan->chip->dw->hdata->reg_map_8_channels) {
++ val = axi_dma_ioread32(chan->chip, DMAC_CHEN);
+ val &= ~(BIT(chan->id) << DMAC_CHAN_SUSP_SHIFT);
+ val |= (BIT(chan->id) << DMAC_CHAN_SUSP_WE_SHIFT);
+ axi_dma_iowrite32(chan->chip, DMAC_CHEN, val);
+ } else {
++ val = axi_dma_ioread32(chan->chip, DMAC_CHSUSPREG);
+ val &= ~(BIT(chan->id) << DMAC_CHAN_SUSP2_SHIFT);
+ val |= (BIT(chan->id) << DMAC_CHAN_SUSP2_WE_SHIFT);
+ axi_dma_iowrite32(chan->chip, DMAC_CHSUSPREG, val);
--- /dev/null
+From 44c4237cf3436bda2b185ff728123651ad133f69 Mon Sep 17 00:00:00 2001
+From: Dave Jiang <dave.jiang@intel.com>
+Date: Tue, 28 Jun 2022 16:00:56 -0700
+Subject: dmaengine: idxd: force wq context cleanup on device disable path
+
+From: Dave Jiang <dave.jiang@intel.com>
+
+commit 44c4237cf3436bda2b185ff728123651ad133f69 upstream.
+
+Testing shown that when a wq mode is setup to be dedicated and then torn
+down and reconfigured to shared, the wq configured end up being dedicated
+anyays. The root cause is when idxd_device_wqs_clear_state() gets called
+during idxd_driver removal, idxd_wq_disable_cleanup() does not get called
+vs when the wq driver is removed first. The check of wq state being
+"enabled" causes the cleanup to be bypassed. However, idxd_driver->remove()
+releases all wq drivers. So the wqs goes to "disabled" state and will never
+be "enabled". By that point, the driver has no idea if the wq was
+previously configured or clean. So force call idxd_wq_disable_cleanup() on
+all wqs always to make sure everything gets cleaned up.
+
+Reported-by: Tony Zhu <tony.zhu@intel.com>
+Tested-by: Tony Zhu <tony.zhu@intel.com>
+Fixes: 0dcfe41e9a4c ("dmanegine: idxd: cleanup all device related bits after disabling device")
+Signed-off-by: Dave Jiang <dave.jiang@intel.com>
+Co-developed-by: Fenghua Yu <fenghua.yu@intel.com>
+Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
+Link: https://lore.kernel.org/r/20220628230056.2527816-1-fenghua.yu@intel.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma/idxd/device.c | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+--- a/drivers/dma/idxd/device.c
++++ b/drivers/dma/idxd/device.c
+@@ -698,10 +698,7 @@ static void idxd_device_wqs_clear_state(
+ for (i = 0; i < idxd->max_wqs; i++) {
+ struct idxd_wq *wq = idxd->wqs[i];
+
+- if (wq->state == IDXD_WQ_ENABLED) {
+- idxd_wq_disable_cleanup(wq);
+- wq->state = IDXD_WQ_DISABLED;
+- }
++ idxd_wq_disable_cleanup(wq);
+ idxd_wq_device_reset_cleanup(wq);
+ }
+ }
--- /dev/null
+From 1dbe67b9faea0bc340cce894018076679c16cb71 Mon Sep 17 00:00:00 2001
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Date: Sun, 22 May 2022 19:41:05 +0200
+Subject: dmaengine: lgm: Fix an error handling path in intel_ldma_probe()
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+commit 1dbe67b9faea0bc340cce894018076679c16cb71 upstream.
+
+ldma_clk_disable() calls both:
+ clk_disable_unprepare(d->core_clk);
+ reset_control_assert(d->rst);
+
+So, should devm_reset_control_get_optional() fail, core_clk should not
+be prepare_enable'd before it, otherwise it will never be
+disable_unprepare'd.
+
+Reorder the code to handle the error handling path as expected.
+
+Fixes: 32d31c79a1a4 ("dmaengine: Add Intel LGM SoC DMA support.")
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Link: https://lore.kernel.org/r/18504549bc4d2b62a72a02cb22a2e4d8e6a58720.1653241224.git.christophe.jaillet@wanadoo.fr
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma/lgm/lgm-dma.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/dma/lgm/lgm-dma.c
++++ b/drivers/dma/lgm/lgm-dma.c
+@@ -1593,11 +1593,12 @@ static int intel_ldma_probe(struct platf
+ d->core_clk = devm_clk_get_optional(dev, NULL);
+ if (IS_ERR(d->core_clk))
+ return PTR_ERR(d->core_clk);
+- clk_prepare_enable(d->core_clk);
+
+ d->rst = devm_reset_control_get_optional(dev, NULL);
+ if (IS_ERR(d->rst))
+ return PTR_ERR(d->rst);
++
++ clk_prepare_enable(d->core_clk);
+ reset_control_deassert(d->rst);
+
+ ret = devm_add_action_or_reset(dev, ldma_clk_disable, d);
--- /dev/null
+From b64b3b2f1d81f83519582e1feee87d77f51f5f17 Mon Sep 17 00:00:00 2001
+From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
+Date: Fri, 20 May 2022 21:14:32 +0300
+Subject: dmaengine: pl330: Fix lockdep warning about non-static key
+
+From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
+
+commit b64b3b2f1d81f83519582e1feee87d77f51f5f17 upstream.
+
+The DEFINE_SPINLOCK() macro shouldn't be used for dynamically allocated
+spinlocks. The lockdep warns about this and disables locking validator.
+Fix the warning by making lock static.
+
+ INFO: trying to register non-static key.
+ The code is fine but needs lockdep annotation, or maybe
+ you didn't initialize this object before use?
+ turning off the locking correctness validator.
+ Hardware name: Radxa ROCK Pi 4C (DT)
+ Call trace:
+ dump_backtrace.part.0+0xcc/0xe0
+ show_stack+0x18/0x6c
+ dump_stack_lvl+0x8c/0xb8
+ dump_stack+0x18/0x34
+ register_lock_class+0x4a8/0x4cc
+ __lock_acquire+0x78/0x20cc
+ lock_acquire.part.0+0xe0/0x230
+ lock_acquire+0x68/0x84
+ _raw_spin_lock_irqsave+0x84/0xc4
+ add_desc+0x44/0xc0
+ pl330_get_desc+0x15c/0x1d0
+ pl330_prep_dma_cyclic+0x100/0x270
+ snd_dmaengine_pcm_trigger+0xec/0x1c0
+ dmaengine_pcm_trigger+0x18/0x24
+ ...
+
+Fixes: e588710311ee ("dmaengine: pl330: fix descriptor allocation fail")
+Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
+Link: https://lore.kernel.org/r/20220520181432.149904-1-dmitry.osipenko@collabora.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma/pl330.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/dma/pl330.c
++++ b/drivers/dma/pl330.c
+@@ -2589,7 +2589,7 @@ static struct dma_pl330_desc *pl330_get_
+
+ /* If the DMAC pool is empty, alloc new */
+ if (!desc) {
+- DEFINE_SPINLOCK(lock);
++ static DEFINE_SPINLOCK(lock);
+ LIST_HEAD(pool);
+
+ if (!add_desc(&pool, &lock, GFP_ATOMIC, 1))
--- /dev/null
+From 0ac9c3dd0d6fe293cd5044cfad10bec27d171e4e Mon Sep 17 00:00:00 2001
+From: Caleb Connolly <caleb.connolly@linaro.org>
+Date: Wed, 29 Jun 2022 15:06:00 +0100
+Subject: dmaengine: qcom: bam_dma: fix runtime PM underflow
+
+From: Caleb Connolly <caleb.connolly@linaro.org>
+
+commit 0ac9c3dd0d6fe293cd5044cfad10bec27d171e4e upstream.
+
+Commit dbad41e7bb5f ("dmaengine: qcom: bam_dma: check if the runtime pm enabled")
+caused unbalanced pm_runtime_get/put() calls when the bam is
+controlled remotely. This commit reverts it and just enables pm_runtime
+in all cases, the clk_* functions already just nop when the clock is NULL.
+
+Also clean up a bit by removing unnecessary bamclk null checks.
+
+Suggested-by: Stephan Gerhold <stephan@gerhold.net>
+Fixes: dbad41e7bb5f ("dmaengine: qcom: bam_dma: check if the runtime pm enabled")
+Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
+Link: https://lore.kernel.org/r/20220629140559.118537-1-caleb.connolly@linaro.org
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma/qcom/bam_dma.c | 39 +++++++++++----------------------------
+ 1 file changed, 11 insertions(+), 28 deletions(-)
+
+--- a/drivers/dma/qcom/bam_dma.c
++++ b/drivers/dma/qcom/bam_dma.c
+@@ -558,14 +558,6 @@ static int bam_alloc_chan(struct dma_cha
+ return 0;
+ }
+
+-static int bam_pm_runtime_get_sync(struct device *dev)
+-{
+- if (pm_runtime_enabled(dev))
+- return pm_runtime_get_sync(dev);
+-
+- return 0;
+-}
+-
+ /**
+ * bam_free_chan - Frees dma resources associated with specific channel
+ * @chan: specified channel
+@@ -581,7 +573,7 @@ static void bam_free_chan(struct dma_cha
+ unsigned long flags;
+ int ret;
+
+- ret = bam_pm_runtime_get_sync(bdev->dev);
++ ret = pm_runtime_get_sync(bdev->dev);
+ if (ret < 0)
+ return;
+
+@@ -784,7 +776,7 @@ static int bam_pause(struct dma_chan *ch
+ unsigned long flag;
+ int ret;
+
+- ret = bam_pm_runtime_get_sync(bdev->dev);
++ ret = pm_runtime_get_sync(bdev->dev);
+ if (ret < 0)
+ return ret;
+
+@@ -810,7 +802,7 @@ static int bam_resume(struct dma_chan *c
+ unsigned long flag;
+ int ret;
+
+- ret = bam_pm_runtime_get_sync(bdev->dev);
++ ret = pm_runtime_get_sync(bdev->dev);
+ if (ret < 0)
+ return ret;
+
+@@ -919,7 +911,7 @@ static irqreturn_t bam_dma_irq(int irq,
+ if (srcs & P_IRQ)
+ tasklet_schedule(&bdev->task);
+
+- ret = bam_pm_runtime_get_sync(bdev->dev);
++ ret = pm_runtime_get_sync(bdev->dev);
+ if (ret < 0)
+ return IRQ_NONE;
+
+@@ -1037,7 +1029,7 @@ static void bam_start_dma(struct bam_cha
+ if (!vd)
+ return;
+
+- ret = bam_pm_runtime_get_sync(bdev->dev);
++ ret = pm_runtime_get_sync(bdev->dev);
+ if (ret < 0)
+ return;
+
+@@ -1374,11 +1366,6 @@ static int bam_dma_probe(struct platform
+ if (ret)
+ goto err_unregister_dma;
+
+- if (!bdev->bamclk) {
+- pm_runtime_disable(&pdev->dev);
+- return 0;
+- }
+-
+ pm_runtime_irq_safe(&pdev->dev);
+ pm_runtime_set_autosuspend_delay(&pdev->dev, BAM_DMA_AUTOSUSPEND_DELAY);
+ pm_runtime_use_autosuspend(&pdev->dev);
+@@ -1462,10 +1449,8 @@ static int __maybe_unused bam_dma_suspen
+ {
+ struct bam_device *bdev = dev_get_drvdata(dev);
+
+- if (bdev->bamclk) {
+- pm_runtime_force_suspend(dev);
+- clk_unprepare(bdev->bamclk);
+- }
++ pm_runtime_force_suspend(dev);
++ clk_unprepare(bdev->bamclk);
+
+ return 0;
+ }
+@@ -1475,13 +1460,11 @@ static int __maybe_unused bam_dma_resume
+ struct bam_device *bdev = dev_get_drvdata(dev);
+ int ret;
+
+- if (bdev->bamclk) {
+- ret = clk_prepare(bdev->bamclk);
+- if (ret)
+- return ret;
++ ret = clk_prepare(bdev->bamclk);
++ if (ret)
++ return ret;
+
+- pm_runtime_force_resume(dev);
+- }
++ pm_runtime_force_resume(dev);
+
+ return 0;
+ }
--- /dev/null
+From 615a4bfc426e11dba05c2cf343f9ac752fb381d2 Mon Sep 17 00:00:00 2001
+From: Miaoqian Lin <linmq006@gmail.com>
+Date: Sun, 5 Jun 2022 08:27:22 +0400
+Subject: dmaengine: ti: Add missing put_device in ti_dra7_xbar_route_allocate
+
+From: Miaoqian Lin <linmq006@gmail.com>
+
+commit 615a4bfc426e11dba05c2cf343f9ac752fb381d2 upstream.
+
+of_find_device_by_node() takes reference, we should use put_device()
+to release it when not need anymore.
+
+Fixes: a074ae38f859 ("dmaengine: Add driver for TI DMA crossbar on DRA7x")
+Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
+Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
+Link: https://lore.kernel.org/r/20220605042723.17668-1-linmq006@gmail.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma/ti/dma-crossbar.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/dma/ti/dma-crossbar.c
++++ b/drivers/dma/ti/dma-crossbar.c
+@@ -245,6 +245,7 @@ static void *ti_dra7_xbar_route_allocate
+ if (dma_spec->args[0] >= xbar->xbar_requests) {
+ dev_err(&pdev->dev, "Invalid XBAR request number: %d\n",
+ dma_spec->args[0]);
++ put_device(&pdev->dev);
+ return ERR_PTR(-EINVAL);
+ }
+
+@@ -252,12 +253,14 @@ static void *ti_dra7_xbar_route_allocate
+ dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0);
+ if (!dma_spec->np) {
+ dev_err(&pdev->dev, "Can't get DMA master\n");
++ put_device(&pdev->dev);
+ return ERR_PTR(-EINVAL);
+ }
+
+ map = kzalloc(sizeof(*map), GFP_KERNEL);
+ if (!map) {
+ of_node_put(dma_spec->np);
++ put_device(&pdev->dev);
+ return ERR_PTR(-ENOMEM);
+ }
+
+@@ -269,6 +272,7 @@ static void *ti_dra7_xbar_route_allocate
+ dev_err(&pdev->dev, "Run out of free DMA requests\n");
+ kfree(map);
+ of_node_put(dma_spec->np);
++ put_device(&pdev->dev);
+ return ERR_PTR(-ENOMEM);
+ }
+ set_bit(map->xbar_out, xbar->dma_inuse);
--- /dev/null
+From c132fe78ad7b4ce8b5d49a501a15c29d08eeb23a Mon Sep 17 00:00:00 2001
+From: Miaoqian Lin <linmq006@gmail.com>
+Date: Sun, 5 Jun 2022 08:27:23 +0400
+Subject: dmaengine: ti: Fix refcount leak in ti_dra7_xbar_route_allocate
+
+From: Miaoqian Lin <linmq006@gmail.com>
+
+commit c132fe78ad7b4ce8b5d49a501a15c29d08eeb23a upstream.
+
+of_parse_phandle() returns a node pointer with refcount
+incremented, we should use of_node_put() on it when not needed anymore.
+
+Add missing of_node_put() in to fix this.
+
+Fixes: ec9bfa1e1a79 ("dmaengine: ti-dma-crossbar: dra7: Use bitops instead of idr")
+Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
+Link: https://lore.kernel.org/r/20220605042723.17668-2-linmq006@gmail.com
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/dma/ti/dma-crossbar.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/dma/ti/dma-crossbar.c
++++ b/drivers/dma/ti/dma-crossbar.c
+@@ -268,6 +268,7 @@ static void *ti_dra7_xbar_route_allocate
+ mutex_unlock(&xbar->mutex);
+ dev_err(&pdev->dev, "Run out of free DMA requests\n");
+ kfree(map);
++ of_node_put(dma_spec->np);
+ return ERR_PTR(-ENOMEM);
+ }
+ set_bit(map->xbar_out, xbar->dma_inuse);
--- /dev/null
+From 607a48c78e6b427b0b684d24e61c19e846ad65d6 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Fri, 1 Jul 2022 22:19:02 -0500
+Subject: dt-bindings: dma: allwinner,sun50i-a64-dma: Fix min/max typo
+
+From: Samuel Holland <samuel@sholland.org>
+
+commit 607a48c78e6b427b0b684d24e61c19e846ad65d6 upstream.
+
+The conditional block for variants with a second clock should have set
+minItems, not maxItems, which was already 2. Since clock-names requires
+two items, this typo should not have caused any problems.
+
+Fixes: edd14218bd66 ("dt-bindings: dmaengine: Convert Allwinner A31 and A64 DMA to a schema")
+Signed-off-by: Samuel Holland <samuel@sholland.org>
+Reviewed-by: Rob Herring <robh@kernel.org>
+Link: https://lore.kernel.org/r/20220702031903.21703-1-samuel@sholland.org
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
++++ b/Documentation/devicetree/bindings/dma/allwinner,sun50i-a64-dma.yaml
+@@ -64,7 +64,7 @@ if:
+ then:
+ properties:
+ clocks:
+- maxItems: 2
++ minItems: 2
+
+ required:
+ - clock-names
--- /dev/null
+From fc82bbf4dede758007763867d0282353c06d1121 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Sun, 10 Jul 2022 13:55:49 -0700
+Subject: ida: don't use BUG_ON() for debugging
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit fc82bbf4dede758007763867d0282353c06d1121 upstream.
+
+This is another old BUG_ON() that just shouldn't exist (see also commit
+a382f8fee42c: "signal handling: don't use BUG_ON() for debugging").
+
+In fact, as Matthew Wilcox points out, this condition shouldn't really
+even result in a warning, since a negative id allocation result is just
+a normal allocation failure:
+
+ "I wonder if we should even warn here -- sure, the caller is trying to
+ free something that wasn't allocated, but we don't warn for
+ kfree(NULL)"
+
+and goes on to point out how that current error check is only causing
+people to unnecessarily do their own index range checking before freeing
+it.
+
+This was noted by Itay Iellin, because the bluetooth HCI socket cookie
+code does *not* do that range checking, and ends up just freeing the
+error case too, triggering the BUG_ON().
+
+The HCI code requires CAP_NET_RAW, and seems to just result in an ugly
+splat, but there really is no reason to BUG_ON() here, and we have
+generally striven for allocation models where it's always ok to just do
+
+ free(alloc());
+
+even if the allocation were to fail for some random reason (usually
+obviously that "random" reason being some resource limit).
+
+Fixes: 88eca0207cf1 ("ida: simplified functions for id allocation")
+Reported-by: Itay Iellin <ieitayie@gmail.com>
+Suggested-by: Matthew Wilcox <willy@infradead.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ lib/idr.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/lib/idr.c
++++ b/lib/idr.c
+@@ -491,7 +491,8 @@ void ida_free(struct ida *ida, unsigned
+ struct ida_bitmap *bitmap;
+ unsigned long flags;
+
+- BUG_ON((int)id < 0);
++ if ((int)id < 0)
++ return;
+
+ xas_lock_irqsave(&xas, flags);
+ bitmap = xas_load(&xas);
misc-rtsx_usb-fix-use-of-dma-mapped-buffer-for-usb-bulk-transfer.patch
misc-rtsx_usb-use-separate-command-and-response-buffers.patch
misc-rtsx_usb-set-return-value-in-rsp_buf-alloc-err-path.patch
+dmaengine-dw-axi-dmac-fix-rmw-on-channel-suspend-register.patch
+dt-bindings-dma-allwinner-sun50i-a64-dma-fix-min-max-typo.patch
+ida-don-t-use-bug_on-for-debugging.patch
+dmaengine-pl330-fix-lockdep-warning-about-non-static-key.patch
+dmaengine-lgm-fix-an-error-handling-path-in-intel_ldma_probe.patch
+dmaengine-at_xdma-handle-errors-of-at_xdmac_alloc_desc-correctly.patch
+dmaengine-ti-fix-refcount-leak-in-ti_dra7_xbar_route_allocate.patch
+dmaengine-qcom-bam_dma-fix-runtime-pm-underflow.patch
+dmaengine-ti-add-missing-put_device-in-ti_dra7_xbar_route_allocate.patch
+dmaengine-idxd-force-wq-context-cleanup-on-device-disable-path.patch