From d0f77d87f5fbfce7c16ace803491340258035a7f Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 19 Feb 2024 18:26:59 +0100 Subject: treewide: use dev_err_probe instead of comparisons against EPROBE_DEFER Drivers should not need to compare an error value against EPROBE_DEFER. We have a number of drivers doing that though to decide whether to print an error or not. This error message will be lost if the probe is deferred, so use dev_err_probe to store the error in that case. While at it, we shorten the error messages a bit. dev_err_probe will already print the string 'error' before the error code string. Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20240219172659.3796647-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- drivers/led/led-gpio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'drivers/led') diff --git a/drivers/led/led-gpio.c b/drivers/led/led-gpio.c index 4b282c7886..c0d14256d3 100644 --- a/drivers/led/led-gpio.c +++ b/drivers/led/led-gpio.c @@ -214,10 +214,7 @@ static int led_gpio_of_probe(struct device *dev) gpio = of_get_named_gpio_flags(child, "gpios", 0, &flags); if (gpio < 0) { - if (gpio != -EPROBE_DEFER) - dev_err(dev, "failed to get gpio for %pOF: %d\n", - child, gpio); - ret = gpio; + ret = dev_err_probe(dev, gpio, "getting gpio for %pOF\n", child); goto err; } -- cgit v1.2.3