Skip to contentSkip to conversation

drm/bridge: dw-hdmi: Fix DDC adapter leak in dw_hdmi_probe()

PATCH New Wentao Liang 1 participant 1 message Sep 16

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/bridge: dw-hdmi: Fix DDC adapter leak in dw_hdmi_probe()

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")
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +2 -1
index 0296e110ce65..1da12e4616fe 100644
@@ -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);
Signature · 1 line
2.34.1