Skip to content

Commit 588d9f4

Browse files
krzklag-linaro
authored andcommitted
backlight: l4f00242t03: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Reviewed-by: Daniel Thompson <[email protected]> Signed-off-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 23749cf commit 588d9f4

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

drivers/video/backlight/l4f00242t03.c

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -179,34 +179,28 @@ static int l4f00242t03_probe(struct spi_device *spi)
179179
priv->spi = spi;
180180

181181
priv->reset = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_HIGH);
182-
if (IS_ERR(priv->reset)) {
183-
dev_err(&spi->dev,
184-
"Unable to get the lcd l4f00242t03 reset gpio.\n");
185-
return PTR_ERR(priv->reset);
186-
}
182+
if (IS_ERR(priv->reset))
183+
return dev_err_probe(&spi->dev, PTR_ERR(priv->reset),
184+
"Unable to get the lcd l4f00242t03 reset gpio.\n");
187185
gpiod_set_consumer_name(priv->reset, "lcd l4f00242t03 reset");
188186

189187
priv->enable = devm_gpiod_get(&spi->dev, "enable", GPIOD_OUT_LOW);
190-
if (IS_ERR(priv->enable)) {
191-
dev_err(&spi->dev,
192-
"Unable to get the lcd l4f00242t03 data en gpio.\n");
193-
return PTR_ERR(priv->enable);
194-
}
188+
if (IS_ERR(priv->enable))
189+
return dev_err_probe(&spi->dev, PTR_ERR(priv->enable),
190+
"Unable to get the lcd l4f00242t03 data en gpio.\n");
195191
gpiod_set_consumer_name(priv->enable, "lcd l4f00242t03 data enable");
196192

197193
priv->io_reg = devm_regulator_get(&spi->dev, "vdd");
198-
if (IS_ERR(priv->io_reg)) {
199-
dev_err(&spi->dev, "%s: Unable to get the IO regulator\n",
200-
__func__);
201-
return PTR_ERR(priv->io_reg);
202-
}
194+
if (IS_ERR(priv->io_reg))
195+
return dev_err_probe(&spi->dev, PTR_ERR(priv->io_reg),
196+
"%s: Unable to get the IO regulator\n",
197+
__func__);
203198

204199
priv->core_reg = devm_regulator_get(&spi->dev, "vcore");
205-
if (IS_ERR(priv->core_reg)) {
206-
dev_err(&spi->dev, "%s: Unable to get the core regulator\n",
207-
__func__);
208-
return PTR_ERR(priv->core_reg);
209-
}
200+
if (IS_ERR(priv->core_reg))
201+
return dev_err_probe(&spi->dev, PTR_ERR(priv->core_reg),
202+
"%s: Unable to get the core regulator\n",
203+
__func__);
210204

211205
priv->ld = devm_lcd_device_register(&spi->dev, "l4f00242t03", &spi->dev,
212206
priv, &l4f_ops);

0 commit comments

Comments
 (0)