Hi Dan On Wed, 2 Apr 2025 at 12:00, Dan Carpenter <dan.carpen...@linaro.org> wrote: > > Call rpi_firmware_put() on these two error paths before returning.
Ack that there is an issue here, but it seems easier to me to move the block max_rate = rpi_firmware_clk_get_max_rate(firmware, RPI_FIRMWARE_CORE_CLK_ID); rpi_firmware_put(firmware); if (max_rate >= 550000000) hvs->vc5_hdmi_enable_hdmi_20 = true; if (max_rate >= 600000000) hvs->vc5_hdmi_enable_4096by2160 = true; hvs->max_core_rate = max_rate; to before we make the devm_clk_get calls. It has no dependencies on having retrieved the clocks, and hopefully means we don't get the same type of leaks creeping back in in future. Thanks Dave > Fixes: 2fa4ef5fb943 ("drm/vc4: hvs: Create hw_init function") > Signed-off-by: Dan Carpenter <dan.carpen...@linaro.org> > --- > 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 4811d794001f..41e9d0aff757 100644 > --- a/drivers/gpu/drm/vc4/vc4_hvs.c > +++ b/drivers/gpu/drm/vc4/vc4_hvs.c > @@ -1678,6 +1678,7 @@ static int vc4_hvs_bind(struct device *dev, struct > device *master, void *data) > hvs->core_clk = devm_clk_get(&pdev->dev, > (vc4->gen >= VC4_GEN_6_C) ? > "core" : NULL); > if (IS_ERR(hvs->core_clk)) { > + rpi_firmware_put(firmware); > dev_err(&pdev->dev, "Couldn't get core clock\n"); > return PTR_ERR(hvs->core_clk); > } > @@ -1685,6 +1686,7 @@ static int vc4_hvs_bind(struct device *dev, struct > device *master, void *data) > hvs->disp_clk = devm_clk_get(&pdev->dev, > (vc4->gen >= VC4_GEN_6_C) ? > "disp" : NULL); > if (IS_ERR(hvs->disp_clk)) { > + rpi_firmware_put(firmware); > dev_err(&pdev->dev, "Couldn't get disp clock\n"); > return PTR_ERR(hvs->disp_clk); > } > -- > 2.47.2 >