Browse Source

[natsemi] Check for ioremap() failures

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
3a02409fc8
1 changed files with 5 additions and 0 deletions
  1. 5
    0
      src/drivers/net/natsemi.c

+ 5
- 0
src/drivers/net/natsemi.c View File

@@ -854,6 +854,10 @@ static int natsemi_probe ( struct pci_device *pci ) {
854 854
 
855 855
 	/* Map registers */
856 856
 	natsemi->regs = ioremap ( pci->membase, NATSEMI_BAR_SIZE );
857
+	if ( ! natsemi->regs ) {
858
+		rc = -ENODEV;
859
+		goto err_ioremap;
860
+	}
857 861
 
858 862
 	/* Reset the NIC */
859 863
 	if ( ( rc = natsemi_reset ( natsemi ) ) != 0 )
@@ -881,6 +885,7 @@ static int natsemi_probe ( struct pci_device *pci ) {
881 885
 	natsemi_reset ( natsemi );
882 886
  err_reset:
883 887
 	iounmap ( natsemi->regs );
888
+ err_ioremap:
884 889
 	netdev_nullify ( netdev );
885 890
 	netdev_put ( netdev );
886 891
  err_alloc:

Loading…
Cancel
Save