Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 209199
b: refs/heads/master
c: e88db3b
h: refs/heads/master
i:
  209197: a0ee760
  209195: aa4f790
  209191: 94ae1ef
  209183: ae1ff8a
v: v3
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Aug 10, 2010
1 parent b9e6751 commit a4b7865
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ca315ac22c1a91fc8047254b250599890d8a7b30
refs/heads/master: e88db3bd46801a9c2cd0ac5e46122d47c285faec
27 changes: 21 additions & 6 deletions trunk/drivers/net/qlcnic/qlcnic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,20 @@ qlcnic_cleanup_pci_map(struct qlcnic_adapter *adapter)
static int
qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
{
struct qlcnic_pci_info pci_info[QLCNIC_MAX_PCI_FUNC];
struct qlcnic_pci_info *pci_info;
int i, ret = 0, err;
u8 pfn;

pci_info = kcalloc(QLCNIC_MAX_PCI_FUNC, sizeof(*pci_info), GFP_KERNEL);
if (!pci_info)
return -ENOMEM;

adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) *
QLCNIC_MAX_PCI_FUNC, GFP_KERNEL);
if (!adapter->npars)
return -ENOMEM;
if (!adapter->npars) {
err = -ENOMEM;
goto err_pci_info;
}

adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) *
QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL);
Expand Down Expand Up @@ -508,6 +514,7 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++)
adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE;

kfree(pci_info);
return 0;

err_eswitch:
Expand All @@ -516,6 +523,8 @@ qlcnic_init_pci_info(struct qlcnic_adapter *adapter)
err_npars:
kfree(adapter->npars);
adapter->npars = NULL;
err_pci_info:
kfree(pci_info);

return ret;
}
Expand Down Expand Up @@ -3362,15 +3371,21 @@ qlcnic_sysfs_read_pci_config(struct file *file, struct kobject *kobj,
struct device *dev = container_of(kobj, struct device, kobj);
struct qlcnic_adapter *adapter = dev_get_drvdata(dev);
struct qlcnic_pci_func_cfg pci_cfg[QLCNIC_MAX_PCI_FUNC];
struct qlcnic_pci_info pci_info[QLCNIC_MAX_PCI_FUNC];
struct qlcnic_pci_info *pci_info;
int i, ret;

if (size != sizeof(pci_cfg))
return QL_STATUS_INVALID_PARAM;

pci_info = kcalloc(QLCNIC_MAX_PCI_FUNC, sizeof(*pci_info), GFP_KERNEL);
if (!pci_info)
return -ENOMEM;

ret = qlcnic_get_pci_info(adapter, pci_info);
if (ret)
if (ret) {
kfree(pci_info);
return ret;
}

for (i = 0; i < QLCNIC_MAX_PCI_FUNC ; i++) {
pci_cfg[i].pci_func = pci_info[i].id;
Expand All @@ -3381,8 +3396,8 @@ qlcnic_sysfs_read_pci_config(struct file *file, struct kobject *kobj,
memcpy(&pci_cfg[i].def_mac_addr, &pci_info[i].mac, ETH_ALEN);
}
memcpy(buf, &pci_cfg, size);
kfree(pci_info);
return size;

}
static struct bin_attribute bin_attr_npar_config = {
.attr = {.name = "npar_config", .mode = (S_IRUGO | S_IWUSR)},
Expand Down

0 comments on commit a4b7865

Please sign in to comment.