[PATCH 2/2] drm/sti: hda: convert to devm_drm_bridge_alloc() API

Luca Ceresoli luca.ceresoli at bootlin.com
Wed Jul 9 09:22:31 UTC 2025


Hi Maxime,

On Wed, 9 Jul 2025 09:32:28 +0200
Maxime Ripard <mripard at kernel.org> wrote:

...

> > @@ -677,7 +683,6 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data)
> >  	struct drm_encoder *encoder;
> >  	struct sti_hda_connector *connector;
> >  	struct drm_connector *drm_connector;
> > -	struct drm_bridge *bridge;
> >  	int err;
> >  
> >  	/* Set the drm device handle */
> > @@ -693,13 +698,7 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data)
> >  
> >  	connector->hda = hda;
> >  
> > -	bridge = devm_kzalloc(dev, sizeof(*bridge), GFP_KERNEL);
> > -	if (!bridge)
> > -		return -ENOMEM;
> > -
> > -	bridge->driver_private = hda;
> > -	bridge->funcs = &sti_hda_bridge_funcs;
> > -	drm_bridge_attach(encoder, bridge, NULL, 0);
> > +	drm_bridge_attach(encoder, &hda->bridge, NULL, 0);  
> 
> It's not entirely related, but the connector is also allocated right
> before and could be moved into the structure instead of storing a
> pointer.
> 
> Either way,
> Reviewed-by: Maxime Ripard <mripard at kernel.org>

Given this patch as-is is fixing a (potentially invisible) bug due to
using the old bridge allocation policy, and the connector allocation
change is an improvements but not a fix, I'll apply as is.

BTW, as a side effect, this series is removing two users of
bridge->driver_private :)

Luca

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


More information about the dri-devel mailing list