serial: 8250_pci: Check mapping in pci_ni8430_init
authorAaron Sierra <asierra@xes-inc.com>
Fri, 31 Oct 2014 00:49:52 +0000 (19:49 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Nov 2014 22:57:25 +0000 (14:57 -0800)
Check the return value of ioremap_nocache to make sure we got a
valid mapping.

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_pci.c

index 50f75703fd54e9dbcdb4d5f1066d514b8dcda7ef..003679fc884bf18a0b609742ce9387ceb9fe8803 100644 (file)
@@ -757,6 +757,8 @@ pci_ni8430_setup(struct serial_private *priv,
        offset += idx * board->uart_offset;
 
        p = pci_ioremap_bar(dev, bar);
+       if (!p)
+               return -ENOMEM;
 
        /* enable the transceiver */
        writeb(readb(p + offset + NI8430_PORTCON) | NI8430_PORTCON_TXVR_ENABLE,