linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] backlight: l4f00242t03: Add a single error handling block at the end of the function.
@ 2021-09-07  6:23 Cai Huoqing
  0 siblings, 0 replies; only message in thread
From: Cai Huoqing @ 2021-09-07  6:23 UTC (permalink / raw)
  To: caihuoqing
  Cc: Lee Jones, Daniel Thompson, Jingoo Han, dri-devel, linux-fbdev,
	linux-kernel

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@baidu.com>
---
 drivers/video/backlight/l4f00242t03.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
index 46f97d1c3d21..c6f540f1b507 100644
--- a/drivers/video/backlight/l4f00242t03.c
+++ b/drivers/video/backlight/l4f00242t03.c
@@ -65,14 +65,12 @@ static void l4f00242t03_lcd_init(struct spi_device *spi)
 	ret = regulator_set_voltage(priv->core_reg, 2800000, 2800000);
 	if (ret) {
 		dev_err(&spi->dev, "failed to set the core regulator voltage.\n");
-		regulator_disable(priv->io_reg);
-		return;
+		goto err_disable_reg;
 	}
 	ret = regulator_enable(priv->core_reg);
 	if (ret) {
 		dev_err(&spi->dev, "failed to enable the core regulator.\n");
-		regulator_disable(priv->io_reg);
-		return;
+		goto err_disable_reg;
 	}
 
 	l4f00242t03_reset(priv->reset);
@@ -80,6 +78,10 @@ static void l4f00242t03_lcd_init(struct spi_device *spi)
 	gpiod_set_value(priv->enable, 1);
 	msleep(60);
 	spi_write(spi, (const u8 *)cmd, ARRAY_SIZE(cmd) * sizeof(u16));
+	return;
+
+err_disable_reg:
+	regulator_disable(priv->io_reg);
 }
 
 static void l4f00242t03_lcd_powerdown(struct spi_device *spi)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-07  6:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07  6:23 [PATCH] backlight: l4f00242t03: Add a single error handling block at the end of the function Cai Huoqing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).