Skip to content

Commit 23749cf

Browse files
krzklag-linaro
authored andcommitted
backlight: gpio: 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. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Daniel Thompson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 3923468 commit 23749cf

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

drivers/video/backlight/gpio_backlight.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,9 @@ static int gpio_backlight_probe(struct platform_device *pdev)
6464
def_value = device_property_read_bool(dev, "default-on");
6565

6666
gbl->gpiod = devm_gpiod_get(dev, NULL, GPIOD_ASIS);
67-
if (IS_ERR(gbl->gpiod)) {
68-
ret = PTR_ERR(gbl->gpiod);
69-
if (ret != -EPROBE_DEFER)
70-
dev_err(dev,
71-
"Error: The gpios parameter is missing or invalid.\n");
72-
return ret;
73-
}
67+
if (IS_ERR(gbl->gpiod))
68+
return dev_err_probe(dev, PTR_ERR(gbl->gpiod),
69+
"The gpios parameter is missing or invalid\n");
7470

7571
memset(&props, 0, sizeof(props));
7672
props.type = BACKLIGHT_RAW;

0 commit comments

Comments
 (0)