]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[realtek] Check for ioremap() failures
authorMichael Brown <mcb30@ipxe.org>
Wed, 16 Jul 2014 14:50:18 +0000 (15:50 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 16 Jul 2014 14:50:18 +0000 (15:50 +0100)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/realtek.c

index 7964475a2f329f725962658aa8ab03e5d98bac0b..0aca8c77f8b9bc9b39e5307d6ac1405247099f56 100644 (file)
@@ -1119,6 +1119,10 @@ static int realtek_probe ( struct pci_device *pci ) {
 
        /* Map registers */
        rtl->regs = ioremap ( pci->membase, RTL_BAR_SIZE );
+       if ( ! rtl->regs ) {
+               rc = -ENODEV;
+               goto err_ioremap;
+       }
 
        /* Reset the NIC */
        if ( ( rc = realtek_reset ( rtl ) ) != 0 )
@@ -1177,6 +1181,7 @@ static int realtek_probe ( struct pci_device *pci ) {
        realtek_reset ( rtl );
  err_reset:
        iounmap ( rtl->regs );
+ err_ioremap:
        netdev_nullify ( netdev );
        netdev_put ( netdev );
  err_alloc: