Re: [PATCH v2] soundwire: mipi_disco: Put fwnode on property array read errors

From: Pierre-Louis Bossart

Date: Thu Nov 12 2026 - 03:31:44 EST


On 11/12/26 07:09, Xiangwu Lai wrote:
> sdw_master_read_prop() and sdw_slave_read_dpn() take a fwnode
> reference with device_get_named_child_node() and already release it
> on the -ENOMEM and success paths. However, the error paths added
> for the property array reads jump straight out without dropping the
> reference, leaking it on every failed read. The lane-list support
> in sdw_slave_read_dpn() is even missing the put on its -ENOMEM path,
> unlike the other array allocations in the same function.
>
> Release the reference on those error paths as well, matching the
> existing -ENOMEM handling in the same functions.
>
> Fixes: a489afc105ed ("soundwire: mipi-disco: add error handling for property array read")
> Fixes: 71b405b18444 ("soundwire: mipi-disco: add support for DP0/DPn 'lane-list' property")
> Signed-off-by: Xiangwu Lai <laixiangwu@xxxxxxxxxxxxxxxxxxxx>
> ---
> Changes in v2:
>
> - Fix the subject of the first Fixes tag to match the commit title
> ("mipi-disco" instead of "mipi_disco") and add a second Fixes tag
> for the lane-list error paths, which were introduced by a different
> commit and also cover the missing put on the lane-list -ENOMEM
> path (suggested by Sashiko AI review).
> - Note: an earlier attempt to fix these leaks using __free() was
> posted in 2024 but never merged:
> https://lore.kernel.org/all/20241019-mipi_disco-of_node_put-v1-1-1de27e6852c4@xxxxxxxxx/

Thanks for the patch, the existing code is indeed inconsistent. LGTM.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxx>