[PATCH 10/10] drm/tidss: oldi: Fix missing of_node_put()s in error paths

From: Tomi Valkeinen

Date: Thu Sep 03 2026 - 09:05:55 EST


If get_oldi_mode() errors early in the function, we don't put the
'companion' device_node. Add the of_node_put() calls.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@xxxxxxxxxxxxxxxx>
Fixes: 7246e0929945 ("drm/tidss: Add OLDI bridge support")
---
drivers/gpu/drm/tidss/tidss_oldi.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tidss/tidss_oldi.c b/drivers/gpu/drm/tidss/tidss_oldi.c
index 624f1646fb07..82b059f85244 100644
--- a/drivers/gpu/drm/tidss/tidss_oldi.c
+++ b/drivers/gpu/drm/tidss/tidss_oldi.c
@@ -383,12 +383,16 @@ static int get_oldi_mode(struct device_node *oldi_tx, int *companion_instance)
*/
return OLDI_MODE_SINGLE_LINK;

- if (of_property_read_u32(companion, "reg", &companion_reg))
+ if (of_property_read_u32(companion, "reg", &companion_reg)) {
+ of_node_put(companion);
return OLDI_MODE_UNSUPPORTED;
+ }

- if (companion_reg > (TIDSS_MAX_OLDI_TXES - 1))
+ if (companion_reg > (TIDSS_MAX_OLDI_TXES - 1)) {
/* Invalid companion OLDI reg value. */
+ of_node_put(companion);
return OLDI_MODE_UNSUPPORTED;
+ }

*companion_instance = (int)companion_reg;


--
2.43.0