drm/bridge: chipone-icn6211: use devm_drm_bridge_add in dsi probe
Subsystems (4)
PATCH v3 2/2 drm/bridge: chipone-icn6211: use devm_drm_bridge_add in dsi probe
Use devm_drm_bridge_add() so the bridge is released if probe fails after registration, and drop drm_bridge_remove() in chipone_dsi_probe.
---
v3: split the patch into two, one for i2c probe (bugfix) and one for dsi probe
v2: devm_drm_bridge_add instead of drm_bridge_add
--- drivers/gpu/drm/bridge/chipone-icn6211.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/bridge/chipone-icn6211.c +3 -5
@@ -730,13 +730,11 @@ static int chipone_dsi_probe(struct mipi_dsi_device *dsi)mipi_dsi_set_drvdata (dsi, icn); -drm_bridge_add (&icn->bridge); - - ret =chipone_dsi_attach (icn); + ret =devm_drm_bridge_add (dev, &icn->bridge);if (ret) -drm_bridge_remove (&icn->bridge); +return ret; -return ret; +return chipone_dsi_attach (icn); }static int chipone_i2c_probe (struct i2c_client *client)
Signature · 1 line
2.43.0
Quoted 7 lines · Osama Abdelkader
Use
devm_drm_bridge_add()so the bridge is released if probe fails after registration, and dropdrm_bridge_remove()inchipone_dsi_probe.Signed-off-by Osama Abdelkader <[email protected]>---
v3: split the patch into two, one for i2c probe (bugfix) and one for dsi probe
v2:devm_drm_bridge_addinstead ofdrm_bridge_add
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Luca Ceresoli
reviewerHello Osama,
Quoted 2 lines · Osama Abdelkader
Use
devm_drm_bridge_add()so the bridge is released if probe fails after registration, and dropdrm_bridge_remove()inchipone_dsi_probe.
Wait, this patch must drop drm_bridge_remove() in chipone_dsi_remove() too! Otherwise it'd be introducing an excess put, and consequent use-after-free.
I have to withdraw my R-by.
You can amend in v4.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Hello Luca,
Quoted 6 lines · Luca Ceresoli
Hello Osama,
Quoted 2 lines · Osama Abdelkader
Use
devm_drm_bridge_add()so the bridge is released if probe fails after registration, and dropdrm_bridge_remove()inchipone_dsi_probe.
Quoted 7 lines
Wait, this patch must drop
drm_bridge_remove()inchipone_dsi_remove()too! Otherwise it'd be introducing an excess put, and consequent use-after-free.I have to withdraw my R-by.
You can amend in v4.
Good catch, added now in v4.
Thanks,
Osama
Quoted 6 lines
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com