diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index b9615bd745ea..6b8df55840c0 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -477,44 +477,45 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter) | |||
477 | int i, ret = 0, err; | 477 | int i, ret = 0, err; |
478 | u8 pfn; | 478 | u8 pfn; |
479 | 479 | ||
480 | if (!adapter->npars) | 480 | adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) * |
481 | adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) * | ||
482 | QLCNIC_MAX_PCI_FUNC, GFP_KERNEL); | 481 | QLCNIC_MAX_PCI_FUNC, GFP_KERNEL); |
483 | if (!adapter->npars) | 482 | if (!adapter->npars) |
484 | return -ENOMEM; | 483 | return -ENOMEM; |
485 | 484 | ||
486 | if (!adapter->eswitch) | 485 | adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) * |
487 | adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) * | ||
488 | QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL); | 486 | QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL); |
489 | if (!adapter->eswitch) { | 487 | if (!adapter->eswitch) { |
490 | err = -ENOMEM; | 488 | err = -ENOMEM; |
491 | goto err_eswitch; | 489 | goto err_npars; |
492 | } | 490 | } |
493 | 491 | ||
494 | ret = qlcnic_get_pci_info(adapter, pci_info); | 492 | ret = qlcnic_get_pci_info(adapter, pci_info); |
495 | if (!ret) { | 493 | if (ret) |
496 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { | 494 | goto err_eswitch; |
497 | pfn = pci_info[i].id; | ||
498 | if (pfn > QLCNIC_MAX_PCI_FUNC) | ||
499 | return QL_STATUS_INVALID_PARAM; | ||
500 | adapter->npars[pfn].active = pci_info[i].active; | ||
501 | adapter->npars[pfn].type = pci_info[i].type; | ||
502 | adapter->npars[pfn].phy_port = pci_info[i].default_port; | ||
503 | adapter->npars[pfn].mac_learning = DEFAULT_MAC_LEARN; | ||
504 | adapter->npars[pfn].min_bw = pci_info[i].tx_min_bw; | ||
505 | adapter->npars[pfn].max_bw = pci_info[i].tx_max_bw; | ||
506 | } | ||
507 | |||
508 | for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++) | ||
509 | adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE; | ||
510 | 495 | ||
511 | return ret; | 496 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { |
497 | pfn = pci_info[i].id; | ||
498 | if (pfn > QLCNIC_MAX_PCI_FUNC) | ||
499 | return QL_STATUS_INVALID_PARAM; | ||
500 | adapter->npars[pfn].active = pci_info[i].active; | ||
501 | adapter->npars[pfn].type = pci_info[i].type; | ||
502 | adapter->npars[pfn].phy_port = pci_info[i].default_port; | ||
503 | adapter->npars[pfn].mac_learning = DEFAULT_MAC_LEARN; | ||
504 | adapter->npars[pfn].min_bw = pci_info[i].tx_min_bw; | ||
505 | adapter->npars[pfn].max_bw = pci_info[i].tx_max_bw; | ||
512 | } | 506 | } |
513 | 507 | ||
508 | for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++) | ||
509 | adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE; | ||
510 | |||
511 | return 0; | ||
512 | |||
513 | err_eswitch: | ||
514 | kfree(adapter->eswitch); | 514 | kfree(adapter->eswitch); |
515 | adapter->eswitch = NULL; | 515 | adapter->eswitch = NULL; |
516 | err_eswitch: | 516 | err_npars: |
517 | kfree(adapter->npars); | 517 | kfree(adapter->npars); |
518 | adapter->npars = NULL; | ||
518 | 519 | ||
519 | return ret; | 520 | return ret; |
520 | } | 521 | } |