[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87fea3e7-7abf-4849-a616-26d1df715408@stanley.mountain>
Date: Thu, 3 Apr 2025 15:13:49 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Dave Stevenson <dave.stevenson@...pberrypi.com>
Cc: Maxime Ripard <mripard@...nel.org>,
MaĆra Canal <mcanal@...lia.com>,
Raspberry Pi Kernel Maintenance <kernel-list@...pberrypi.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] drm/vc4: release firmware on error paths in
vc4_hvs_bind()
On Wed, Apr 02, 2025 at 11:34:58AM +0000, Dave Stevenson wrote:
> Hi Dan
>
> On Wed, 2 Apr 2025 at 12:00, Dan Carpenter <dan.carpenter@...aro.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.
>
Yeah. That's a good cleanup. I will resend.
regards,
dan carpenter
> Thanks
> Dave
>
> > Fixes: 2fa4ef5fb943 ("drm/vc4: hvs: Create hw_init function")
> > Signed-off-by: Dan Carpenter <dan.carpenter@...aro.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
> >
Powered by blists - more mailing lists