From: Michael Brown Date: Wed, 16 Jul 2014 14:51:38 +0000 (+0100) Subject: [vmxnet3] Check for ioremap() failures X-Git-Tag: v1.20.1~1128 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ab3035749137136cfada2f36e1f50c68e570913;p=thirdparty%2Fipxe.git [vmxnet3] Check for ioremap() failures Signed-off-by: Michael Brown --- diff --git a/src/drivers/net/vmxnet3.c b/src/drivers/net/vmxnet3.c index 9401c110e..57013fb9d 100644 --- a/src/drivers/net/vmxnet3.c +++ b/src/drivers/net/vmxnet3.c @@ -602,8 +602,16 @@ static int vmxnet3_probe ( struct pci_device *pci ) { /* Map PCI BARs */ vmxnet->pt = ioremap ( pci_bar_start ( pci, VMXNET3_PT_BAR ), VMXNET3_PT_LEN ); + if ( ! vmxnet->pt ) { + rc = -ENODEV; + goto err_ioremap_pt; + } vmxnet->vd = ioremap ( pci_bar_start ( pci, VMXNET3_VD_BAR ), VMXNET3_VD_LEN ); + if ( ! vmxnet->vd ) { + rc = -ENODEV; + goto err_ioremap_vd; + } /* Version check */ if ( ( rc = vmxnet3_check_version ( vmxnet ) ) != 0 ) @@ -633,7 +641,9 @@ static int vmxnet3_probe ( struct pci_device *pci ) { err_reset: err_check_version: iounmap ( vmxnet->vd ); + err_ioremap_vd: iounmap ( vmxnet->pt ); + err_ioremap_pt: netdev_nullify ( netdev ); netdev_put ( netdev ); err_alloc_etherdev: