Re: [PATCH 04/15] dmaengine: dw: dmamux: fix OF node leak on route allocation failure

From: Miquel Raynal
Date: Tue Nov 18 2025 - 04:21:46 EST


Hi Andy,

On 17/11/2025 at 18:05:47 +01, Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> On Mon, Nov 17, 2025 at 05:12:47PM +0100, Johan Hovold wrote:
>> Make sure to drop the reference taken to the DMA master OF node also on
>> late route allocation failures.
>
> ...
>
>> +put_dma_spec_np:
>> + of_node_put(dma_spec->np);
>
> Can we use __free() instead?

I probably haven't followed closely enough, but I don't understand how
__free() is best than of_node_put() in front of of_parse_phandle()?
Especially since the doc clearly states

"Return: The device_node pointer with refcount incremented.
Use of_node_put() on it when done."

> (Just in case you are going to question the appearance of cleanup.h and the
> respective class in of.h, it's available in the closest stable, i.e.
> v6.1.108 onwards).

I don't believe including a recent header is a good practice for stable
inclusion anyway. I would recommend to let the commit as it is and in a
follow-up patch, maybe, we can move to a newer API if we want. This way
history between stable and mailine versions is easier to compare.

Reviewed-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>

Thanks,
Miquèl