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:
parent
cee9d9b039
commit
36674f6bf8
1 changed files with 6 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue