Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: dw: dmamux: fix OF node leak on route allocation failure

Make sure to drop the reference taken to the DMA master OF node also on
late route allocation failures.

Fixes: 134d9c52fca2 ("dmaengine: dw: dmamux: Introduce RZN1 DMA router support")
Cc: stable@vger.kernel.org # 5.19
Cc: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://patch.msgid.link/20251117161258.10679-6-johan@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Johan Hovold and committed by
Vinod Koul
ec25e60f 7bb7d696

+3 -1
+3 -1
drivers/dma/dw/rzn1-dmamux.c
··· 90 90 91 91 if (test_and_set_bit(map->req_idx, dmamux->used_chans)) { 92 92 ret = -EBUSY; 93 - goto free_map; 93 + goto put_dma_spec_np; 94 94 } 95 95 96 96 mask = BIT(map->req_idx); ··· 103 103 104 104 clear_bitmap: 105 105 clear_bit(map->req_idx, dmamux->used_chans); 106 + put_dma_spec_np: 107 + of_node_put(dma_spec->np); 106 108 free_map: 107 109 kfree(map); 108 110 put_device: