diff options
author | Rajesh Borundia <rajesh.borundia@qlogic.com> | 2013-04-02 05:34:41 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-04-02 14:27:11 -0400 |
commit | f1a094a83059b4677038befde6c4da6cfed31dbd (patch) | |
tree | 7a0b3c9d14bfc01b1d44a43c061f925b6646d92f /drivers/net/ethernet/qlogic | |
parent | d8fe3436df256ce48d953dc342ac114e6e368476 (diff) |
qlcnic: Fix NULL dereference in error path.
o Fix for smatch tool reported error
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c:2029
qlcnic_probe() error: potential NULL dereference 'adapter'.
o While returning from an error path in probe, adapter is not
initialized. So do not access adapter in cleanup path.
Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qlogic')
-rw-r--r-- | drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c index 3ee593ee13c..0d00b2bd2c8 100644 --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c @@ -546,11 +546,10 @@ void qlcnic_teardown_intr(struct qlcnic_adapter *adapter) } } -static void -qlcnic_cleanup_pci_map(struct qlcnic_adapter *adapter) +static void qlcnic_cleanup_pci_map(struct qlcnic_hardware_context *ahw) { - if (adapter->ahw->pci_base0 != NULL) - iounmap(adapter->ahw->pci_base0); + if (ahw->pci_base0 != NULL) + iounmap(ahw->pci_base0); } static int qlcnic_get_act_pci_func(struct qlcnic_adapter *adapter) @@ -2026,7 +2025,7 @@ err_out_free_netdev: free_netdev(netdev); err_out_iounmap: - qlcnic_cleanup_pci_map(adapter); + qlcnic_cleanup_pci_map(ahw); err_out_free_hw_res: kfree(ahw); @@ -2083,7 +2082,7 @@ static void qlcnic_remove(struct pci_dev *pdev) qlcnic_remove_sysfs(adapter); - qlcnic_cleanup_pci_map(adapter); + qlcnic_cleanup_pci_map(adapter->ahw); qlcnic_release_firmware(adapter); |