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

index 669fb8775235dbe0b852ad88d3f972de72af601a..9f2c3029c58f4a60f92d125837b70425919c7ea6 100644 (file)
@@ -854,6 +854,10 @@ static int natsemi_probe ( struct pci_device *pci ) {
 
        /* Map registers */
        natsemi->regs = ioremap ( pci->membase, NATSEMI_BAR_SIZE );
+       if ( ! natsemi->regs ) {
+               rc = -ENODEV;
+               goto err_ioremap;
+       }
 
        /* Reset the NIC */
        if ( ( rc = natsemi_reset ( natsemi ) ) != 0 )
@@ -881,6 +885,7 @@ static int natsemi_probe ( struct pci_device *pci ) {
        natsemi_reset ( natsemi );
  err_reset:
        iounmap ( natsemi->regs );
+ err_ioremap:
        netdev_nullify ( netdev );
        netdev_put ( netdev );
  err_alloc: