mfd: madera: 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 <krzk@kernel.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
Krzysztof Kozlowski 2020-08-26 16:49:33 +02:00 committed by Lee Jones
parent ede6b2d1df
commit f104563fe0
1 changed files with 3 additions and 8 deletions

View File

@ -369,19 +369,14 @@ EXPORT_SYMBOL_GPL(madera_of_match);
static int madera_get_reset_gpio(struct madera *madera) static int madera_get_reset_gpio(struct madera *madera)
{ {
struct gpio_desc *reset; struct gpio_desc *reset;
int ret;
if (madera->pdata.reset) if (madera->pdata.reset)
return 0; return 0;
reset = devm_gpiod_get_optional(madera->dev, "reset", GPIOD_OUT_LOW); reset = devm_gpiod_get_optional(madera->dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(reset)) { if (IS_ERR(reset))
ret = PTR_ERR(reset); return dev_err_probe(madera->dev, PTR_ERR(reset),
if (ret != -EPROBE_DEFER) "Failed to request /RESET");
dev_err(madera->dev, "Failed to request /RESET: %d\n",
ret);
return ret;
}
/* /*
* A hard reset is needed for full reset of the chip. We allow running * A hard reset is needed for full reset of the chip. We allow running