serial: ns16550: return error when init fails

The init function returns successful even if the first
configuration function call fails. This may leave
a non-usable UART to be discoverable with
device_get_binding() which will definitely result
in lots of head scratching. So change the init function
to return properly.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2020-05-13 17:08:02 -07:00 committed by Carles Cufí
commit 36674f6bf8

View file

@ -469,7 +469,12 @@ static int uart_ns16550_config_get(struct device *dev, struct uart_config *cfg)
*/
static int uart_ns16550_init(struct device *dev)
{
uart_ns16550_configure(dev, &DEV_DATA(dev)->uart_config);
int ret;
ret = uart_ns16550_configure(dev, &DEV_DATA(dev)->uart_config);
if (ret != 0) {
return ret;
}
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
DEV_CFG(dev)->devconf.irq_config_func(dev);