diff mbox series

[RESEND] drm/i2c/tda9950: use devm_add_action_or_reset() helper

Message ID F8054A8509C09C5E+20240925061819.729842-1-helugang@uniontech.com (mailing list archive)
State New, archived
Headers show
Series [RESEND] drm/i2c/tda9950: use devm_add_action_or_reset() helper | expand

Commit Message

He Lugang Sept. 25, 2024, 6:18 a.m. UTC
Use devm_add_action_or_reset() to release resources in case of failure,
because the cleanup function will be automatically called.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: He Lugang <helugang@uniontech.com>
---
 drivers/gpu/drm/i2c/tda9950.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i2c/tda9950.c b/drivers/gpu/drm/i2c/tda9950.c
index 82d618c40dce..e9dae19d7acd 100644
--- a/drivers/gpu/drm/i2c/tda9950.c
+++ b/drivers/gpu/drm/i2c/tda9950.c
@@ -361,11 +361,7 @@  static int tda9950_devm_glue_init(struct device *dev, struct tda9950_glue *glue)
 			return ret;
 	}
 
-	ret = devm_add_action(dev, tda9950_devm_glue_exit, glue);
-	if (ret)
-		tda9950_devm_glue_exit(glue);
-
-	return ret;
+	return devm_add_action_or_reset(dev, tda9950_devm_glue_exit, glue);
 }
 
 static void tda9950_cec_del(void *data)
@@ -425,11 +421,9 @@  static int tda9950_probe(struct i2c_client *client)
 	if (IS_ERR(priv->adap))
 		return PTR_ERR(priv->adap);
 
-	ret = devm_add_action(dev, tda9950_cec_del, priv);
-	if (ret) {
-		cec_delete_adapter(priv->adap);
+	ret = devm_add_action_or_reset(dev, tda9950_cec_del, priv);
+	if (ret)
 		return ret;
-	}
 
 	ret = tda9950_devm_glue_init(dev, glue);
 	if (ret)