mirror of https://gitee.com/openkylin/linux.git
gpio: pisosr: 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> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
This commit is contained in:
parent
ca6a77eb34
commit
308a028d07
|
@ -148,12 +148,9 @@ static int pisosr_gpio_probe(struct spi_device *spi)
|
|||
return -ENOMEM;
|
||||
|
||||
gpio->load_gpio = devm_gpiod_get_optional(dev, "load", GPIOD_OUT_LOW);
|
||||
if (IS_ERR(gpio->load_gpio)) {
|
||||
ret = PTR_ERR(gpio->load_gpio);
|
||||
if (ret != -EPROBE_DEFER)
|
||||
dev_err(dev, "Unable to allocate load GPIO\n");
|
||||
return ret;
|
||||
}
|
||||
if (IS_ERR(gpio->load_gpio))
|
||||
return dev_err_probe(dev, PTR_ERR(gpio->load_gpio),
|
||||
"Unable to allocate load GPIO\n");
|
||||
|
||||
mutex_init(&gpio->lock);
|
||||
|
||||
|
|
Loading…
Reference in New Issue