Re: [PATCH v3] drm/bridge: Fix refcount shown via debugfs for encoder_bridges_show()
From: Luca Ceresoli
Date: Thu Mar 26 2026 - 06:43:36 EST
On Wed, 18 Mar 2026 13:26:05 +0800, Liu Ying wrote:
> A typical bridge refcount value is 3 after a bridge chain is formed:
> - devm_drm_bridge_alloc() initializes the refcount value to be 1.
> - drm_bridge_add() gets an additional reference hence 2.
> - drm_bridge_attach() gets the third reference hence 3.
>
> This typical refcount value aligns with allbridges_show()'s behaviour.
> However, since encoder_bridges_show() uses
> drm_for_each_bridge_in_chain_scoped() to automatically get/put the
> bridge reference while iterating, a bogus reference is accidentally
> got when showing the wrong typical refcount value as 4 to users via
> debugfs. Fix this by caching the refcount value returned from
> kref_read() while iterating and explicitly decreasing the cached
> refcount value by 1 before showing it to users.
>
> [...]
Applied, thanks!
[1/1] drm/bridge: Fix refcount shown via debugfs for encoder_bridges_show()
commit: f078634c184a9b5ccaa056e8b8d6cd32f7bff1b6
Best regards,
--
Luca Ceresoli <luca.ceresoli@xxxxxxxxxxx>