On Wed, Nov 19, 2025 at 02:28:41PM +0000, Louis Chauvet wrote:
> On 11/19/25 13:05, Luca Ceresoli wrote:
> > of_drm_find_bridge() does not increment the returned bridge
> > refcount. drm_of_find_bridge() is to be used as a replacement.
> > 
> > Suggested-by: Maxime Ripard <[email protected]>
> > Link: 
> > https://lore.kernel.org/dri-devel/20250319-stylish-lime-mongoose-0a18ad@houat/
> > Signed-off-by: Luca Ceresoli <[email protected]>
> > ---
> >   drivers/gpu/drm/drm_bridge.c | 7 +++++--
> >   1 file changed, 5 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> > index d98a7b4a83c0..6debbf20aaa8 100644
> > --- a/drivers/gpu/drm/drm_bridge.c
> > +++ b/drivers/gpu/drm/drm_bridge.c
> > @@ -299,7 +299,7 @@ EXPORT_SYMBOL(__devm_drm_bridge_alloc);
> >    * @bridge: bridge control structure
> >    *
> >    * Add the given bridge to the global list of bridges, where they can be
> > - * found by users via of_drm_find_bridge().
> > + * found by users via drm_of_find_bridge().
> >    *
> >    * The bridge to be added must have been allocated by
> >    * devm_drm_bridge_alloc().
> > @@ -360,7 +360,7 @@ EXPORT_SYMBOL(devm_drm_bridge_add);
> >    * @bridge: bridge control structure
> >    *
> >    * Remove the given bridge from the global list of registered bridges, so
> > - * it won't be found by users via of_drm_find_bridge(), and add it to the
> > + * it won't be found by users via drm_of_find_bridge(), and add it to the
> >    * lingering bridge list, to keep track of it until its allocated memory 
> > is
> >    * eventually freed.
> >    */
> > @@ -1452,6 +1452,9 @@ EXPORT_SYMBOL(drm_of_find_bridge);
> >    *
> >    * @np: device node
> >    *
> > + * This function is deprecated. Use drm_of_find_bridge() instead for proper
> > + * refcounting.
> > + *
> 
> I think it should be more explicit that the refcounting is not done by this
> function, like:
> 
>       This function is deprecated. The returned bridge is not refcounted, you
> should not use drm_bridge_put(). Use drm_of_find_bridge() instead for proper
> refcounting.

I'd rather say that the callers must take care of the refcounting by
themselves but that it's racy, or at least that it *must* not use
drm_bridge_put().

Maxime

Attachment: signature.asc
Description: PGP signature

Reply via email to