[PATCH] drm: panel: tl070wsh30: Add a single error handling block at the end of the function.

Cai Huoqing caihuoqing at baidu.com
Tue Sep 7 06:23:48 UTC 2021


A single error handling block at the end of the function could
be brought in to make code a little more concise.

Signed-off-by: Cai Huoqing <caihuoqing at baidu.com>
---
 drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c b/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c
index 820731be7147..5e54ef4b3a9c 100644
--- a/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c
+++ b/drivers/gpu/drm/panel/panel-tdo-tl070wsh30.c
@@ -59,8 +59,7 @@ static int tdo_tl070wsh30_panel_prepare(struct drm_panel *panel)
 	err = mipi_dsi_dcs_exit_sleep_mode(tdo_tl070wsh30->link);
 	if (err < 0) {
 		dev_err(panel->dev, "failed to exit sleep mode: %d\n", err);
-		regulator_disable(tdo_tl070wsh30->supply);
-		return err;
+		goto err_disable_reg;
 	}
 
 	msleep(200);
@@ -68,8 +67,7 @@ static int tdo_tl070wsh30_panel_prepare(struct drm_panel *panel)
 	err = mipi_dsi_dcs_set_display_on(tdo_tl070wsh30->link);
 	if (err < 0) {
 		dev_err(panel->dev, "failed to set display on: %d\n", err);
-		regulator_disable(tdo_tl070wsh30->supply);
-		return err;
+		goto err_disable_reg;
 	}
 
 	msleep(20);
@@ -77,6 +75,9 @@ static int tdo_tl070wsh30_panel_prepare(struct drm_panel *panel)
 	tdo_tl070wsh30->prepared = true;
 
 	return 0;
+err_disable_reg:
+	regulator_disable(tdo_tl070wsh30->supply);
+	return err;
 }
 
 static int tdo_tl070wsh30_panel_unprepare(struct drm_panel *panel)
-- 
2.25.1



More information about the dri-devel mailing list