Commit 3738d48b authored by David S. Miller's avatar David S. Miller

Merge branch 'octeon_ep-fixes'

Ziyang Xuan says:

====================
octeon_ep: fix several bugs in exception paths

Find several obvious bugs during code review in exception paths. Provide
this patchset to fix them. Not tested, just compiled.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 991aef4e 848ffce2
...@@ -521,14 +521,12 @@ static int octep_open(struct net_device *netdev) ...@@ -521,14 +521,12 @@ static int octep_open(struct net_device *netdev)
octep_oq_dbell_init(oct); octep_oq_dbell_init(oct);
ret = octep_get_link_status(oct); ret = octep_get_link_status(oct);
if (ret) if (ret > 0)
octep_link_up(netdev); octep_link_up(netdev);
return 0; return 0;
set_queues_err: set_queues_err:
octep_napi_disable(oct);
octep_napi_delete(oct);
octep_clean_irqs(oct); octep_clean_irqs(oct);
setup_irq_err: setup_irq_err:
octep_free_oqs(oct); octep_free_oqs(oct);
...@@ -958,7 +956,7 @@ int octep_device_setup(struct octep_device *oct) ...@@ -958,7 +956,7 @@ int octep_device_setup(struct octep_device *oct)
ret = octep_ctrl_mbox_init(ctrl_mbox); ret = octep_ctrl_mbox_init(ctrl_mbox);
if (ret) { if (ret) {
dev_err(&pdev->dev, "Failed to initialize control mbox\n"); dev_err(&pdev->dev, "Failed to initialize control mbox\n");
return -1; goto unsupported_dev;
} }
oct->ctrl_mbox_ifstats_offset = OCTEP_CTRL_MBOX_SZ(ctrl_mbox->h2fq.elem_sz, oct->ctrl_mbox_ifstats_offset = OCTEP_CTRL_MBOX_SZ(ctrl_mbox->h2fq.elem_sz,
ctrl_mbox->h2fq.elem_cnt, ctrl_mbox->h2fq.elem_cnt,
...@@ -968,6 +966,10 @@ int octep_device_setup(struct octep_device *oct) ...@@ -968,6 +966,10 @@ int octep_device_setup(struct octep_device *oct)
return 0; return 0;
unsupported_dev: unsupported_dev:
for (i = 0; i < OCTEP_MMIO_REGIONS; i++)
iounmap(oct->mmio[i].hw_addr);
kfree(oct->conf);
return -1; return -1;
} }
...@@ -1070,7 +1072,11 @@ static int octep_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1070,7 +1072,11 @@ static int octep_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
netdev->max_mtu = OCTEP_MAX_MTU; netdev->max_mtu = OCTEP_MAX_MTU;
netdev->mtu = OCTEP_DEFAULT_MTU; netdev->mtu = OCTEP_DEFAULT_MTU;
octep_get_mac_addr(octep_dev, octep_dev->mac_addr); err = octep_get_mac_addr(octep_dev, octep_dev->mac_addr);
if (err) {
dev_err(&pdev->dev, "Failed to get mac address\n");
goto register_dev_err;
}
eth_hw_addr_set(netdev, octep_dev->mac_addr); eth_hw_addr_set(netdev, octep_dev->mac_addr);
err = register_netdev(netdev); err = register_netdev(netdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment