瀏覽代碼

[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 10 年之前
父節點
當前提交
9ce2b56af6
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 5
    0
      src/drivers/net/intel.c
  2. 5
    0
      src/drivers/net/intelx.c

+ 5
- 0
src/drivers/net/intel.c 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存