[PATCH] drm/tidss: oldi: convert to devm_drm_bridge_alloc() API

Aradhya Bhatia aradhya.bhatia at linux.dev
Wed Jul 9 22:07:09 UTC 2025


Hi Jayesh,

Thank you for testing the OLDI series out, and finding and reporting the
issue.

On 01/07/25 06:50, Jayesh Choudhary wrote:
> DRM bridges now uses "devm_drm_bridge_alloc()" for allocation and
> initialization. "devm_kzalloc()" is not allowed anymore and it results
> in WARNING. So convert it.
> 
> Fixes: 7246e0929945 ("drm/tidss: Add OLDI bridge support")
> Signed-off-by: Jayesh Choudhary <j-choudhary at ti.com>
> ---
> 
> Warning log:
> <https://gist.github.com/Jayesh2000/e42c235bb57cb0f0af06c8c3bf886ef2>
> 
>  drivers/gpu/drm/tidss/tidss_oldi.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tidss/tidss_oldi.c b/drivers/gpu/drm/tidss/tidss_oldi.c
> index 8223b8fec8ce..b0f99656e87e 100644
> --- a/drivers/gpu/drm/tidss/tidss_oldi.c
> +++ b/drivers/gpu/drm/tidss/tidss_oldi.c
> @@ -534,11 +534,10 @@ int tidss_oldi_init(struct tidss_device *tidss)
>  			continue;
>  		}
>  
> -		oldi = devm_kzalloc(tidss->dev, sizeof(*oldi), GFP_KERNEL);
> -		if (!oldi) {
> -			ret = -ENOMEM;
> -			goto err_put_node;
> -		}
> +		oldi = devm_drm_bridge_alloc(tidss->dev, struct tidss_oldi, bridge,
> +					     &tidss_oldi_bridge_funcs);
> +		if (IS_ERR(oldi))
> +			return PTR_ERR(oldi);

The 'child' and 'oldi_parent' device nodes need to be put back before
the error is returned.

This should do it.
	
	ret = PTR_ERR(oldi);
	goto err_put_node;

>  
>  		oldi->parent_vp = parent_vp;
>  		oldi->oldi_instance = oldi_instance;
> @@ -577,7 +576,6 @@ int tidss_oldi_init(struct tidss_device *tidss)
>  		/* Register the bridge. */
>  		oldi->bridge.of_node = child;
>  		oldi->bridge.driver_private = oldi;
> -		oldi->bridge.funcs = &tidss_oldi_bridge_funcs;
>  		oldi->bridge.timings = &default_tidss_oldi_timings;
>  
>  		tidss->oldis[tidss->num_oldis++] = oldi;

With that changed,

Reviewed-by: Aradhya Bhatia <aradhya.bhatia at linux.dev>

-- 
Regards
Aradhya



More information about the dri-devel mailing list