[PATCH 05/10] drm/bridge: lontium-lt9611uxc: switch to of_drm_get_bridge_by_endpoint()
Dmitry Baryshkov
dmitry.baryshkov at oss.qualcomm.com
Mon Apr 13 11:01:34 PDT 2026
On Mon, Apr 13, 2026 at 03:58:37PM +0200, Luca Ceresoli wrote:
> This driver calls drm_of_find_panel_or_bridge() with a NULL pointer in the
> @panel parameter, thus using a reduced feature set of that function.
> Replace this call with the simpler of_drm_get_bridge_by_endpoint().
>
> Since of_drm_get_bridge_by_endpoint() increases the refcount of the
> returned bridge, ensure it is put on removal. To achieve this, instead of
> adding an explicit drm_bridge_put(), migrate to the bridge::next_bridge
> pointer which is automatically put when the bridge is eventually freed.
What if the driver's _probe fails between increasing this refcount and
actually registering the bridge? There are enough possible cases. I
think this also applies to other patches in the series (BTW, including
the msm/hdmi, which I ack'ed).
>
> Signed-off-by: Luca Ceresoli <luca.ceresoli at bootlin.com>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
> index 11aab07d88df..55b80a488c33 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c
> @@ -35,7 +35,6 @@
> struct lt9611uxc {
> struct device *dev;
> struct drm_bridge bridge;
> - struct drm_bridge *next_bridge;
>
> struct regmap *regmap;
> /* Protects all accesses to registers by stopping the on-chip MCU */
> @@ -284,7 +283,7 @@ static int lt9611uxc_bridge_attach(struct drm_bridge *bridge,
> {
> struct lt9611uxc *lt9611uxc = bridge_to_lt9611uxc(bridge);
>
> - return drm_bridge_attach(encoder, lt9611uxc->next_bridge,
> + return drm_bridge_attach(encoder, lt9611uxc->bridge.next_bridge,
> bridge, flags);
> }
>
> @@ -487,7 +486,7 @@ static int lt9611uxc_parse_dt(struct device *dev,
>
> lt9611uxc->dsi1_node = of_graph_get_remote_node(dev->of_node, 1, -1);
>
> - return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, <9611uxc->next_bridge);
> + return of_drm_get_bridge_by_endpoint(dev->of_node, 2, -1, <9611uxc->bridge.next_bridge);
> }
>
> static int lt9611uxc_gpio_init(struct lt9611uxc *lt9611uxc)
>
> --
> 2.53.0
>
--
With best wishes
Dmitry
More information about the linux-arm-kernel
mailing list