Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[intel] Check for ioremap() failures
Debugged-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Jul 16, 2014
1 parent ae77809 commit 9ce2b56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/drivers/net/intel.c
Expand Up @@ -819,6 +819,10 @@ static int intel_probe ( struct pci_device *pci ) {

/* Map registers */
intel->regs = ioremap ( pci->membase, INTEL_BAR_SIZE );
if ( ! intel->regs ) {
rc = -ENODEV;
goto err_ioremap;
}

/* Reset the NIC */
if ( ( rc = intel_reset ( intel ) ) != 0 )
Expand All @@ -843,6 +847,7 @@ static int intel_probe ( struct pci_device *pci ) {
intel_reset ( intel );
err_reset:
iounmap ( intel->regs );
err_ioremap:
netdev_nullify ( netdev );
netdev_put ( netdev );
err_alloc:
Expand Down
5 changes: 5 additions & 0 deletions src/drivers/net/intelx.c
Expand Up @@ -400,6 +400,10 @@ static int intelx_probe ( struct pci_device *pci ) {

/* Map registers */
intel->regs = ioremap ( pci->membase, INTEL_BAR_SIZE );
if ( ! intel->regs ) {
rc = -ENODEV;
goto err_ioremap;
}

/* Reset the NIC */
if ( ( rc = intelx_reset ( intel ) ) != 0 )
Expand All @@ -424,6 +428,7 @@ static int intelx_probe ( struct pci_device *pci ) {
intelx_reset ( intel );
err_reset:
iounmap ( intel->regs );
err_ioremap:
netdev_nullify ( netdev );
netdev_put ( netdev );
err_alloc:
Expand Down

0 comments on commit 9ce2b56

Please sign in to comment.