Skip to contentSkip to conversation

drm/tidss: oldi: convert to devm_drm_bridge_alloc() API

PATCH Superseded Jayesh Choudhary 3 participants 3 messages Jul 1, 2025 – Jul 9, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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")

---

Warning log:
<https://gist.github.com/Jayesh2000/e42c235bb57cb0f0af06c8c3bf886ef2>

 drivers/gpu/drm/tidss/tidss_oldi.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/tidss/tidss_oldi.c +4 -6
index 8223b8fec8ce..b0f99656e87e 100644
@@ -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);
 
 		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;
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Jayesh Choudhary

DRM bridges now uses "devm_drm_bridge_alloc()" for allocation and

s/uses/use

Quoted 5 lines

initialization. "devm_kzalloc()" is not allowed anymore and it results in WARNING. So convert it.

Fixes 7246e0929945 ("drm/tidss: Add OLDI bridge support")

Regards
Devarsh

Quoted 36 lines

---

Warning log:
<https://gist.github.com/Jayesh2000/e42c235bb57cb0f0af06c8c3bf886ef2>

  drivers/gpu/drm/tidss/tidss_oldi.c | 10 ++++------
  1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/tidss/tidss_oldi.c +4 -6
index 8223b8fec8ce..b0f99656e87e 100644
@@ -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);
 
  		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;
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jayesh Choudhary

Hi Jayesh,

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

Quoted 21 lines · Jayesh Choudhary

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")

---

Warning log:
<https://gist.github.com/Jayesh2000/e42c235bb57cb0f0af06c8c3bf886ef2>

 drivers/gpu/drm/tidss/tidss_oldi.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/tidss/tidss_oldi.c +0 -0
index 8223b8fec8ce..b0f99656e87e 100644
@@ -534,11 +534,10 @@ int tidss_oldi_init(struct tidss_device *tidss)
 			continue;
 		}

drivers/gpu/drm/tidss/tidss_oldi.c int tidss_oldi_init(struct tidss_device *tidss) · line 540

Quoted 10 lines
drivers/gpu/drm/tidss/tidss_oldi.c +4 -5
 
-		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;

drivers/gpu/drm/tidss/tidss_oldi.c int tidss_oldi_init(struct tidss_device *tidss) · line 581

Quoted 11 lines
drivers/gpu/drm/tidss/tidss_oldi.c +0 -1
 		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,

Signature · 2 lines
Regards
Aradhya