mux: gpio: Simplify code by using dev_err_probe()

Use already prepared dev_err_probe() introduced by the commit
a787e5400a ("driver core: add device probe log helper").
It simplifies EPROBE_DEFER handling.

Acked-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210330193325.68362-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Andy Shevchenko 2021-03-30 22:33:25 +03:00 committed by Greg Kroah-Hartman
parent 7fef54e255
commit 38ab861493

View File

@ -66,12 +66,9 @@ static int mux_gpio_probe(struct platform_device *pdev)
mux_chip->ops = &mux_gpio_ops; mux_chip->ops = &mux_gpio_ops;
mux_gpio->gpios = devm_gpiod_get_array(dev, "mux", GPIOD_OUT_LOW); mux_gpio->gpios = devm_gpiod_get_array(dev, "mux", GPIOD_OUT_LOW);
if (IS_ERR(mux_gpio->gpios)) { if (IS_ERR(mux_gpio->gpios))
ret = PTR_ERR(mux_gpio->gpios); return dev_err_probe(dev, PTR_ERR(mux_gpio->gpios),
if (ret != -EPROBE_DEFER) "failed to get gpios\n");
dev_err(dev, "failed to get gpios\n");
return ret;
}
WARN_ON(pins != mux_gpio->gpios->ndescs); WARN_ON(pins != mux_gpio->gpios->ndescs);
mux_chip->mux->states = BIT(pins); mux_chip->mux->states = BIT(pins);