Re: [PATCH v2 2/7] drm: verisilicon: stop using deprecated devm_drm_of_get_bridge()

From: Luca Ceresoli

Date: Tue Sep 29 2026 - 17:27:12 EST


Hello,

On Tue Sep 29, 2026 at 4:42 PM CEST, Icenowy Zheng wrote:
> 在 2026-09-29二的 15:39 +0200,Luca Ceresoli写道:
>> devm_drm_of_get_bridge() is deprecated, switch to
>> of_drm_get_bridge_by_endpoint(). As of_drm_get_bridge_by_endpoint()
>> returns
>> a refcounted bridge, ensure it is put by using bridge.next_bridge.
>>
>> Fixes build failure when CONFIG_OF is disabled.
>>
>> Fixes: aa8a8c7e4641 ("drm/bridge: panel: move all code to
>> drm_panel.c")
>> Reported-by: Arnd Bergmann <arnd@xxxxxxxxxx>
>> Closes:
>> https://lore.kernel.org/r/20260928161605.2271412-1-arnd@xxxxxxxxxx
>> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>> Closes:
>> https://lore.kernel.org/oe-kbuild-all/202609291109.OIsGTysr-lkp@xxxxxxxxx/
>> Closes:
>> https://lore.kernel.org/oe-kbuild-all/202609290408.BOs7sk55-lkp@xxxxxxxxx/
>> Signed-off-by: Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx>
>
> Checked the code in drm_bridge.c, and it looks like the lifetime of
> next_bridge should be indirectly managed by devm when
> devm_drm_bridge_alloc() successes and the next_bridge field assigned,
> so the only explicit put needed here should be in the alloc failure
> path.

Exactly.

I think vs_bridge_init() could be simplified a bit by moving the 'next =
...;' statement (with error management trailer) to after
devm_drm_bridge_alloc. This would avoid the explicit drm_bridge_put() call
added by this patch.

However for this regression fix I preferred to keep the diff minimal. The
cleanup mentioned above can be done later.

> Reviewed-by: Icenowy Zheng <zhengxingda@xxxxxxxxxxx>

Thanks for reviewing!

>> Changes in v2:
>> - fix bridge reference leak on attach error path
>
> It should be `bridge alloc error` instead of `attach error`, but I
> don't know how to correct the error in the changelog, and anyway it
> won't be part of the final commit.

Ah, right, that's a copy-paste leftover. It's correct that it won't appear
in the commit, so I won't sent a new iteration for this.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com