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

Loading…
Cancel
Save