Skip to content

Commit

Permalink
Merge branch 'octeon_ep-fixes'
Browse files Browse the repository at this point in the history
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: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Nov 14, 2022
2 parents 991aef4 + 848ffce commit 3738d48
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions drivers/net/ethernet/marvell/octeon_ep/octep_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,14 +521,12 @@ static int octep_open(struct net_device *netdev)
octep_oq_dbell_init(oct);

ret = octep_get_link_status(oct);
if (ret)
if (ret > 0)
octep_link_up(netdev);

return 0;

set_queues_err:
octep_napi_disable(oct);
octep_napi_delete(oct);
octep_clean_irqs(oct);
setup_irq_err:
octep_free_oqs(oct);
Expand Down Expand Up @@ -958,7 +956,7 @@ int octep_device_setup(struct octep_device *oct)
ret = octep_ctrl_mbox_init(ctrl_mbox);
if (ret) {
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,
ctrl_mbox->h2fq.elem_cnt,
Expand All @@ -968,6 +966,10 @@ int octep_device_setup(struct octep_device *oct)
return 0;

unsupported_dev:
for (i = 0; i < OCTEP_MMIO_REGIONS; i++)
iounmap(oct->mmio[i].hw_addr);

kfree(oct->conf);
return -1;
}

Expand Down Expand Up @@ -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->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);

err = register_netdev(netdev);
Expand Down

0 comments on commit 3738d48

Please sign in to comment.