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

Configure Feed

Select the types of activity you want to include in your feed.

dmaengine: sh: rz-dmac: fix device leak on probe failure

Make sure to drop the reference taken when looking up the ICU device
during probe also on probe failures (e.g. probe deferral).

Fixes: 7de873201c44 ("dmaengine: sh: rz-dmac: Add RZ/V2H(P) support")
Cc: stable@vger.kernel.org # 6.16
Cc: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Link: https://patch.msgid.link/20251117161258.10679-10-johan@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Johan Hovold and committed by
Vinod Koul
9fb49032 d9847e6d

+11 -2
+11 -2
drivers/dma/sh/rz-dmac.c
··· 854 854 return 0; 855 855 } 856 856 857 + static void rz_dmac_put_device(void *_dev) 858 + { 859 + struct device *dev = _dev; 860 + 861 + put_device(dev); 862 + } 863 + 857 864 static int rz_dmac_parse_of_icu(struct device *dev, struct rz_dmac *dmac) 858 865 { 859 866 struct device_node *np = dev->of_node; ··· 882 875 dev_err(dev, "ICU device not found.\n"); 883 876 return -ENODEV; 884 877 } 878 + 879 + ret = devm_add_action_or_reset(dev, rz_dmac_put_device, &dmac->icu.pdev->dev); 880 + if (ret) 881 + return ret; 885 882 886 883 dmac_index = args.args[0]; 887 884 if (dmac_index > RZV2H_MAX_DMAC_INDEX) { ··· 1066 1055 reset_control_assert(dmac->rstc); 1067 1056 pm_runtime_put(&pdev->dev); 1068 1057 pm_runtime_disable(&pdev->dev); 1069 - 1070 - platform_device_put(dmac->icu.pdev); 1071 1058 } 1072 1059 1073 1060 static const struct of_device_id of_rz_dmac_match[] = {