Selaa lähdekoodia

[intel] Check for ioremap() failures

Debugged-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 vuotta sitten
vanhempi
commit
9ce2b56af6
2 muutettua tiedostoa jossa 10 lisäystä ja 0 poistoa
  1. 5
    0
      src/drivers/net/intel.c
  2. 5
    0
      src/drivers/net/intelx.c

+ 5
- 0
src/drivers/net/intel.c Näytä tiedosto

@@ -819,6 +819,10 @@ static int intel_probe ( struct pci_device *pci ) {
819 819
 
820 820
 	/* Map registers */
821 821
 	intel->regs = ioremap ( pci->membase, INTEL_BAR_SIZE );
822
+	if ( ! intel->regs ) {
823
+		rc = -ENODEV;
824
+		goto err_ioremap;
825
+	}
822 826
 
823 827
 	/* Reset the NIC */
824 828
 	if ( ( rc = intel_reset ( intel ) ) != 0 )
@@ -843,6 +847,7 @@ static int intel_probe ( struct pci_device *pci ) {
843 847
 	intel_reset ( intel );
844 848
  err_reset:
845 849
 	iounmap ( intel->regs );
850
+ err_ioremap:
846 851
 	netdev_nullify ( netdev );
847 852
 	netdev_put ( netdev );
848 853
  err_alloc:

+ 5
- 0
src/drivers/net/intelx.c Näytä tiedosto

@@ -400,6 +400,10 @@ static int intelx_probe ( struct pci_device *pci ) {
400 400
 
401 401
 	/* Map registers */
402 402
 	intel->regs = ioremap ( pci->membase, INTEL_BAR_SIZE );
403
+	if ( ! intel->regs ) {
404
+		rc = -ENODEV;
405
+		goto err_ioremap;
406
+	}
403 407
 
404 408
 	/* Reset the NIC */
405 409
 	if ( ( rc = intelx_reset ( intel ) ) != 0 )
@@ -424,6 +428,7 @@ static int intelx_probe ( struct pci_device *pci ) {
424 428
 	intelx_reset ( intel );
425 429
  err_reset:
426 430
 	iounmap ( intel->regs );
431
+ err_ioremap:
427 432
 	netdev_nullify ( netdev );
428 433
 	netdev_put ( netdev );
429 434
  err_alloc:

Loading…
Peruuta
Tallenna