Commit 55d2c487 authored by Russell King's avatar Russell King

[SERIAL] Fix failure checks

We originally checked for failure by checking if the returned code
was non-zero.  Strictly, it should be a negative value.
parent 7f114818
...@@ -1031,7 +1031,7 @@ static int serial_link_irq_chain(struct uart_8250_port *up) ...@@ -1031,7 +1031,7 @@ static int serial_link_irq_chain(struct uart_8250_port *up)
ret = request_irq(up->port.irq, serial8250_interrupt, ret = request_irq(up->port.irq, serial8250_interrupt,
irq_flags, "serial", i); irq_flags, "serial", i);
if (ret) if (ret < 0)
serial_do_unlink(i, up); serial_do_unlink(i, up);
} }
...@@ -1623,7 +1623,7 @@ static int serial8250_request_port(struct uart_port *port) ...@@ -1623,7 +1623,7 @@ static int serial8250_request_port(struct uart_port *port)
if (up->port.flags & UPF_RESOURCES) { if (up->port.flags & UPF_RESOURCES) {
if (up->port.type == PORT_RSA) { if (up->port.type == PORT_RSA) {
ret = serial8250_request_rsa_resource(up, &res_rsa); ret = serial8250_request_rsa_resource(up, &res_rsa);
if (ret) if (ret < 0)
return ret; return ret;
} }
...@@ -1641,7 +1641,7 @@ static int serial8250_request_port(struct uart_port *port) ...@@ -1641,7 +1641,7 @@ static int serial8250_request_port(struct uart_port *port)
ret = -ENOMEM; ret = -ENOMEM;
} }
if (ret) { if (ret < 0) {
if (res_rsa) if (res_rsa)
release_resource(res_rsa); release_resource(res_rsa);
if (res) if (res)
...@@ -1671,11 +1671,11 @@ static void serial8250_config_port(struct uart_port *port, int flags) ...@@ -1671,11 +1671,11 @@ static void serial8250_config_port(struct uart_port *port, int flags)
*/ */
if (up->port.flags & UPF_RESOURCES) { if (up->port.flags & UPF_RESOURCES) {
ret = serial8250_request_std_resource(up, &res_std); ret = serial8250_request_std_resource(up, &res_std);
if (ret) if (ret < 0)
return; return;
ret = serial8250_request_rsa_resource(up, &res_rsa); ret = serial8250_request_rsa_resource(up, &res_rsa);
if (ret) if (ret < 0)
probeflags &= ~PROBE_RSA; probeflags &= ~PROBE_RSA;
} else { } else {
probeflags &= ~PROBE_RSA; probeflags &= ~PROBE_RSA;
...@@ -2030,11 +2030,10 @@ static int __init serial8250_init(void) ...@@ -2030,11 +2030,10 @@ static int __init serial8250_init(void)
spin_lock_init(&irq_lists[i].lock); spin_lock_init(&irq_lists[i].lock);
ret = uart_register_driver(&serial8250_reg); ret = uart_register_driver(&serial8250_reg);
if (ret) if (ret >= 0)
return ret; serial8250_register_ports(&serial8250_reg);
serial8250_register_ports(&serial8250_reg); return ret;
return 0;
} }
static void __exit serial8250_exit(void) static void __exit serial8250_exit(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment