Skip to contentSkip to conversation

drm/bridge: dw-hdmi: fix i2c adapter leak on probe failure

PATCH Applied Johan Hovold 3 participants 4 messages Jul 17 – Jul 27

Subsystems (4)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/bridge: dw-hdmi: fix i2c adapter leak on probe failure

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 Neil Armstrong <[email protected]>
---
 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 17d5caedb32e..9eb6cf8a321f 100644
@@ -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);
Signature · 1 line
2.54.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Johan Hovold

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 Neil Armstrong <[email protected]>
Quoted 18 lines
---
 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 17d5caedb32e..9eb6cf8a321f 100644
@@ -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);
Signature · 3 lines
Regards,

Laurent Pinchart
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Johan Hovold
Quoted 7 lines · Johan Hovold

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 Neil Armstrong <[email protected]>

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

reviewer Applied
#3 lore raw
In reply to Johan Hovold
Quoted 2 lines · Johan Hovold

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

Applied, thanks!

[1/1] drm/bridge: dw-hdmi: fix i2c adapter leak on probe failure

      commit: 09b195a7bb23df56269cd2a95d01ba3a5533af13

Best regards,

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com