[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] ns16550: Re-order the serial port address checking



commit 102b439f910e761bf92eed9fdf45d49bc6fba5d4
Author:     Wei Xu <xuwei5@xxxxxxxxxxxxx>
AuthorDate: Wed Feb 26 10:56:23 2020 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Feb 26 10:56:23 2020 +0100

    ns16550: Re-order the serial port address checking
    
    The serial port address space ID qualifies the address. Whether a value
    of zero for the serial port address can sensibly mean "disabled" depends
    on the address space ID. Hence check the address space ID before
    checking the address.
    
    Signed-off-by: Wei Xu <xuwei5@xxxxxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/drivers/char/ns16550.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index ab068c56dc..d8b52eb813 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1645,6 +1645,12 @@ static int __init ns16550_acpi_uart_init(const void 
*data)
 
     spcr = container_of(table, struct acpi_table_spcr, header);
 
+    if ( unlikely(spcr->serial_port.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) )
+    {
+        printk("ns16550: Address space type is not mmio\n");
+        return -EINVAL;
+    }
+
     /*
      * The serial port address may be 0 for example
      * if the console redirection is disabled.
@@ -1655,12 +1661,6 @@ static int __init ns16550_acpi_uart_init(const void 
*data)
         return -EINVAL;
     }
 
-    if ( unlikely(spcr->serial_port.space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) )
-    {
-        printk("ns16550: Address space type is not mmio\n");
-        return -EINVAL;
-    }
-
     ns16550_init_common(uart);
 
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.