[PATCH] drm/bridge: dw-hdmi: Fix DDC adapter leak in dw_hdmi_probe()
From: Wentao Liang
Date: Wed Sep 16 2026 - 06:26:10 EST
dw_hdmi_probe() takes a reference to the DDC I2C adapter specified
through the ddc-i2c-bus property with of_get_i2c_adapter_by_node().
All the subsequent error paths unwind through the err_res label, which
releases the adapter with i2c_put_adapter(), except the invalid
reg-io-width path which returns ERR_PTR(-EINVAL) directly, leaking the
DDC adapter reference.
Jump to the err_res label instead of returning directly so that the
DDC adapter reference is dropped on that error path too.
Fixes: 80e2f97968b5 ("drm: bridge: dw-hdmi: Switch to regmap for register access")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 0296e110ce65..1da12e4616fe 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -3400,7 +3400,8 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
break;
default:
dev_err(dev, "reg-io-width must be 1 or 4\n");
- return ERR_PTR(-EINVAL);
+ ret = -EINVAL;
+ goto err_res;
}
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
--
2.34.1