Browse Source

[vmxnet3] Check for ioremap() failures

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

+ 10
- 0
src/drivers/net/vmxnet3.c View File

602
 	/* Map PCI BARs */
602
 	/* Map PCI BARs */
603
 	vmxnet->pt = ioremap ( pci_bar_start ( pci, VMXNET3_PT_BAR ),
603
 	vmxnet->pt = ioremap ( pci_bar_start ( pci, VMXNET3_PT_BAR ),
604
 			       VMXNET3_PT_LEN );
604
 			       VMXNET3_PT_LEN );
605
+	if ( ! vmxnet->pt ) {
606
+		rc = -ENODEV;
607
+		goto err_ioremap_pt;
608
+	}
605
 	vmxnet->vd = ioremap ( pci_bar_start ( pci, VMXNET3_VD_BAR ),
609
 	vmxnet->vd = ioremap ( pci_bar_start ( pci, VMXNET3_VD_BAR ),
606
 			       VMXNET3_VD_LEN );
610
 			       VMXNET3_VD_LEN );
611
+	if ( ! vmxnet->vd ) {
612
+		rc = -ENODEV;
613
+		goto err_ioremap_vd;
614
+	}
607
 
615
 
608
 	/* Version check */
616
 	/* Version check */
609
 	if ( ( rc = vmxnet3_check_version ( vmxnet ) ) != 0 )
617
 	if ( ( rc = vmxnet3_check_version ( vmxnet ) ) != 0 )
633
  err_reset:
641
  err_reset:
634
  err_check_version:
642
  err_check_version:
635
 	iounmap ( vmxnet->vd );
643
 	iounmap ( vmxnet->vd );
644
+ err_ioremap_vd:
636
 	iounmap ( vmxnet->pt );
645
 	iounmap ( vmxnet->pt );
646
+ err_ioremap_pt:
637
 	netdev_nullify ( netdev );
647
 	netdev_nullify ( netdev );
638
 	netdev_put ( netdev );
648
 	netdev_put ( netdev );
639
  err_alloc_etherdev:
649
  err_alloc_etherdev:

Loading…
Cancel
Save