[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<TYCPR01MB120937B42EF315F79D0F55B8DC2D6A@TYCPR01MB12093.jpnprd01.prod.outlook.com>
Date: Tue, 18 Nov 2025 13:49:54 +0000
From: Fabrizio Castro <fabrizio.castro.jz@...esas.com>
To: Johan Hovold <johan@...nel.org>, Vinod Koul <vkoul@...nel.org>
CC: Ludovic Desroches <ludovic.desroches@...rochip.com>, Viresh Kumar
<vireshk@...nel.org>, Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Vinicius Costa Gomes <vinicius.gomes@...el.com>, Dave Jiang
<dave.jiang@...el.com>, Vladimir Zapolskiy <vz@...ia.com>, Piotr Wojtaszczyk
<piotr.wojtaszczyk@...esys.com>, Amélie Delaunay
<amelie.delaunay@...s.st.com>, Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>, Peter Ujfalusi
<peter.ujfalusi@...il.com>, "dmaengine@...r.kernel.org"
<dmaengine@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "stable@...r.kernel.org"
<stable@...r.kernel.org>
Subject: RE: [PATCH 08/15] dmaengine: sh: rz-dmac: fix device leak on probe
failure
> From: Johan Hovold <johan@...nel.org>
> Sent: 17 November 2025 16:13
> To: Vinod Koul <vkoul@...nel.org>
> Cc: Ludovic Desroches <ludovic.desroches@...rochip.com>; Viresh Kumar <vireshk@...nel.org>; Andy
> Shevchenko <andriy.shevchenko@...ux.intel.com>; Vinicius Costa Gomes <vinicius.gomes@...el.com>; Dave
> Jiang <dave.jiang@...el.com>; Vladimir Zapolskiy <vz@...ia.com>; Piotr Wojtaszczyk
> <piotr.wojtaszczyk@...esys.com>; Amélie Delaunay <amelie.delaunay@...s.st.com>; Maxime Coquelin
> <mcoquelin.stm32@...il.com>; Alexandre Torgue <alexandre.torgue@...s.st.com>; Peter Ujfalusi
> <peter.ujfalusi@...il.com>; dmaengine@...r.kernel.org; linux-kernel@...r.kernel.org; Johan Hovold
> <johan@...nel.org>; stable@...r.kernel.org; Fabrizio Castro <fabrizio.castro.jz@...esas.com>
> Subject: [PATCH 08/15] 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@...r.kernel.org # 6.16
> Cc: Fabrizio Castro <fabrizio.castro.jz@...esas.com>
> Signed-off-by: Johan Hovold <johan@...nel.org>
Reviewed-by: Fabrizio Castro <fabrizio.castro.jz@...esas.com>
> ---
> drivers/dma/sh/rz-dmac.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
> index 1f687b08d6b8..38137e8d80b9 100644
> --- a/drivers/dma/sh/rz-dmac.c
> +++ b/drivers/dma/sh/rz-dmac.c
> @@ -854,6 +854,13 @@ static int rz_dmac_chan_probe(struct rz_dmac *dmac,
> return 0;
> }
>
> +static void rz_dmac_put_device(void *_dev)
> +{
> + struct device *dev = _dev;
> +
> + put_device(dev);
> +}
> +
> static int rz_dmac_parse_of_icu(struct device *dev, struct rz_dmac *dmac)
> {
> struct device_node *np = dev->of_node;
> @@ -876,6 +883,10 @@ static int rz_dmac_parse_of_icu(struct device *dev, struct rz_dmac *dmac)
> return -ENODEV;
> }
>
> + ret = devm_add_action_or_reset(dev, rz_dmac_put_device, &dmac->icu.pdev->dev);
> + if (ret)
> + return ret;
> +
> dmac_index = args.args[0];
> if (dmac_index > RZV2H_MAX_DMAC_INDEX) {
> dev_err(dev, "DMAC index %u invalid.\n", dmac_index);
> @@ -1055,8 +1066,6 @@ static void rz_dmac_remove(struct platform_device *pdev)
> reset_control_assert(dmac->rstc);
> pm_runtime_put(&pdev->dev);
> pm_runtime_disable(&pdev->dev);
> -
> - platform_device_put(dmac->icu.pdev);
> }
>
> static const struct of_device_id of_rz_dmac_match[] = {
> --
> 2.51.0
Powered by blists - more mailing lists