[PATCH v11 08/21] drm/bridge: synopsys: dw-dp: Free output_fmts when none are valid

Andy Yan andyshrk at 163.com
Sun Aug 16 05:56:29 PDT 2026



Hello Sebastian,

At 2026-08-07 01:02:14, "Sebastian Reichel" <sebastian.reichel at collabora.com> wrote:
>If dw_dp_bandwidth_ok() returns false for all formats, *num_output_fmts
>might end up becoming 0. In this case functions calling it assume that
>nothing needs to be free'd, so free output_fmts within the function to
>avoid leaking memory.
>
>Fixes: 86eecc3a9c2e ("drm/bridge: synopsys: Add DW DPTX Controller support library")
>Reported-by: Sashiko <sashiko-bot at kernel.org>
>Signed-off-by: Sebastian Reichel <sebastian.reichel at collabora.com>

  Reviewed-by: Andy Yan <andy.yan at rock-chips.com>

>---
> drivers/gpu/drm/bridge/synopsys/dw-dp.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
>diff --git a/drivers/gpu/drm/bridge/synopsys/dw-dp.c b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
>index 8ceb139f1a72..d35dcd4a413f 100644
>--- a/drivers/gpu/drm/bridge/synopsys/dw-dp.c
>+++ b/drivers/gpu/drm/bridge/synopsys/dw-dp.c
>@@ -1820,6 +1820,11 @@ static u32 *dw_dp_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
> 		output_fmts[j++] = fmt->bus_format;
> 	}
> 
>+	if (j == 0) {
>+		kfree(output_fmts);
>+		output_fmts = NULL;
>+	}
>+
> 	*num_output_fmts = j;
> 
> 	return output_fmts;
>
>-- 
>2.53.0
>
>
>_______________________________________________
>Linux-rockchip mailing list
>Linux-rockchip at lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/linux-rockchip


More information about the Linux-rockchip mailing list