[PATCH] drm/vc4: Fix firmware reference leak in vc4_hvs_bind()

From: Wentao Liang

Date: Wed Sep 16 2026 - 12:30:20 EST


The firmware reference taken via rpi_firmware_get() is leaked when
either of the devm_clk_get() calls for the core or display clocks
fails, as both error paths return without releasing it.

Put the firmware reference before returning from both clock lookup
error paths.

Fixes: 2a001ca00ad5 ("drm/vc4: hdmi: Rework hdmi_enable_4kp60 detection code")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/gpu/drm/vc4/vc4_hvs.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c
index ee8d0738501b..20dde4150068 100644
--- a/drivers/gpu/drm/vc4/vc4_hvs.c
+++ b/drivers/gpu/drm/vc4/vc4_hvs.c
@@ -1680,6 +1680,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
(vc4->gen >= VC4_GEN_6_C) ? "core" : NULL);
if (IS_ERR(hvs->core_clk)) {
dev_err(&pdev->dev, "Couldn't get core clock\n");
+ rpi_firmware_put(firmware);
return PTR_ERR(hvs->core_clk);
}

@@ -1687,6 +1688,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
(vc4->gen >= VC4_GEN_6_C) ? "disp" : NULL);
if (IS_ERR(hvs->disp_clk)) {
dev_err(&pdev->dev, "Couldn't get disp clock\n");
+ rpi_firmware_put(firmware);
return PTR_ERR(hvs->disp_clk);
}

--
2.34.1