Make sure to drop the i2c adapter device and module references before
returning when detecting a malformed devicetree during probe.

Fixes: 80e2f97968b5 ("drm: bridge: dw-hdmi: Switch to regmap for register 
access")
Cc: [email protected]      # 4.12
Cc: Neil Armstrong <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
---
 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 17d5caedb32e..9eb6cf8a321f 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -3389,7 +3389,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.54.0

Reply via email to