Skip to contentSkip to conversation

drm/bridge: use devm_add_action_or_reset() to handle failed condition

PATCH In review Tian Tao 2 participants 2 messages Dec 16, 2020 – Dec 17, 2020

Subsystems (3)
lore
Share & tools
lore

Tian Tao

author
#0 lore raw

PATCH 1/1 drm/bridge: use devm_add_action_or_reset() to handle failed condition

switch to using devm_add_action_or_reset() instead of devm_add_action to avoid call the cec_delete_adapter,when devm_add_action_or_reset return failed.

---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c +2 -4
index 70ab4fb..c8f44bc 100644
@@ -265,11 +265,9 @@ static int dw_hdmi_cec_probe(struct platform_device *pdev)
 	/* override the module pointer */
 	cec->adap->owner = THIS_MODULE;
 
-	ret = devm_add_action(&pdev->dev, dw_hdmi_cec_del, cec);
-	if (ret) {
-		cec_delete_adapter(cec->adap);
+	ret = devm_add_action_or_reset(&pdev->dev, dw_hdmi_cec_del, cec);
+	if (ret)
 		return ret;
-	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, cec->irq,
 					dw_hdmi_cec_hardirq,
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
reviewer Reviewed-by on v1 1/1
#1 lore raw

Hi Tian,

Thank you for the patch.

Quoted 5 lines · Tian Tao

switch to using devm_add_action_or_reset() instead of devm_add_action to avoid call the cec_delete_adapter,when devm_add_action_or_reset return failed.

Quoted 22 lines
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c +2 -4
index 70ab4fb..c8f44bc 100644
@@ -265,11 +265,9 @@ static int dw_hdmi_cec_probe(struct platform_device *pdev)
 	/* override the module pointer */
 	cec->adap->owner = THIS_MODULE;
 
-	ret = devm_add_action(&pdev->dev, dw_hdmi_cec_del, cec);
-	if (ret) {
-		cec_delete_adapter(cec->adap);
+	ret = devm_add_action_or_reset(&pdev->dev, dw_hdmi_cec_del, cec);
+	if (ret)
 		return ret;
-	}
 
 	ret = devm_request_threaded_irq(&pdev->dev, cec->irq,
 					dw_hdmi_cec_hardirq,
Signature · 7 lines
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel