Re: [PATCH] drm/vc4: Fix firmware reference leak in vc4_hvs_bind()
From: Maíra Canal
Date: Thu Sep 17 2026 - 20:28:49 EST
Hi Wentao,
On 16/09/26 12:41, Wentao Liang wrote:
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);
Instead of adding this line twice, move the line `firmware =
rpi_firmware_get(node)` closer to its actual use. Then, you don't need
to add these `rpi_firmware_put()` calls.
The same comment applies to your other PATCH: `[PATCH] drm/vc4: Fix
firmware reference leak in vc4_drm_bind()`.
Best regards,
- Maíra
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);
}