[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAG3jFyvW3YxG8jNq9krRJmWUbTFc3sXNXTjnsY0Pmgky6GJgQQ@mail.gmail.com>
Date: Fri, 19 Mar 2021 15:37:51 +0100
From: Robert Foss <robert.foss@...aro.org>
To: Lyude Paul <lyude@...hat.com>
Cc: intel-gfx@...ts.freedesktop.org,
dri-devel <dri-devel@...ts.freedesktop.org>,
amd-gfx@...ts.freedesktop.org, nouveau@...ts.freedesktop.org,
Ville Syrjälä <ville.syrjala@...ux.intel.com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
Andrzej Hajda <a.hajda@...sung.com>,
Neil Armstrong <narmstrong@...libre.com>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...l.net>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Boris Brezillon <boris.brezillon@...labora.com>,
Tomi Valkeinen <tomi.valkeinen@...com>,
Sam Ravnborg <sam@...nborg.org>, Torsten Duwe <duwe@....de>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 09/30] drm/bridge/analogix/anx78xx: Cleanup on error in anx78xx_bridge_attach()
Hey Lyude,
Thanks for the patch, it looks good to me.
Reviewed-by: Robert Foss <robert.foss@...aro.org>
On Fri, 19 Feb 2021 at 22:56, Lyude Paul <lyude@...hat.com> wrote:
>
> Just another issue I noticed while correcting usages of
> drm_dp_aux_init()/drm_dp_aux_register() around the tree. If any of the
> steps in anx78xx_bridge_attach() fail, we end up leaking resources. So,
> let's fix that (and fix leaking a DP AUX adapter in the process) by
> unrolling on errors.
>
> Signed-off-by: Lyude Paul <lyude@...hat.com>
> ---
> drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
> index 338dd8531d4b..f20558618220 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
> @@ -918,7 +918,7 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge,
> DRM_MODE_CONNECTOR_DisplayPort);
> if (err) {
> DRM_ERROR("Failed to initialize connector: %d\n", err);
> - return err;
> + goto aux_unregister;
> }
>
> drm_connector_helper_add(&anx78xx->connector,
> @@ -930,16 +930,21 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge,
> bridge->encoder);
> if (err) {
> DRM_ERROR("Failed to link up connector to encoder: %d\n", err);
> - return err;
> + goto connector_cleanup;
> }
>
> err = drm_connector_register(&anx78xx->connector);
> if (err) {
> DRM_ERROR("Failed to register connector: %d\n", err);
> - return err;
> + goto connector_cleanup;
> }
>
> return 0;
> +connector_cleanup:
> + drm_connector_cleanup(&anx78xx->connector);
> +aux_unregister:
> + drm_dp_aux_unregister(&anx78xx->aux);
> + return err;
> }
>
> static void anx78xx_bridge_detach(struct drm_bridge *bridge)
> --
> 2.29.2
>
Powered by blists - more mailing lists