Commit 7061b2bd authored by Markus Elfring's avatar Markus Elfring Committed by David S. Miller

qlogic: Deletion of unnecessary checks before two function calls

The functions kfree() and vfree() perform also input parameter validation.
Thus the test around their calls is not needed.

This issue was detected by using the Coccinelle software.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent adfde051
...@@ -294,9 +294,7 @@ int qlcnic_alloc_sds_rings(struct qlcnic_recv_context *recv_ctx, int count) ...@@ -294,9 +294,7 @@ int qlcnic_alloc_sds_rings(struct qlcnic_recv_context *recv_ctx, int count)
void qlcnic_free_sds_rings(struct qlcnic_recv_context *recv_ctx) void qlcnic_free_sds_rings(struct qlcnic_recv_context *recv_ctx)
{ {
if (recv_ctx->sds_rings != NULL)
kfree(recv_ctx->sds_rings); kfree(recv_ctx->sds_rings);
recv_ctx->sds_rings = NULL; recv_ctx->sds_rings = NULL;
} }
...@@ -1257,7 +1255,6 @@ qlcnic_check_options(struct qlcnic_adapter *adapter) ...@@ -1257,7 +1255,6 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
if (ahw->op_mode != QLCNIC_NON_PRIV_FUNC) { if (ahw->op_mode != QLCNIC_NON_PRIV_FUNC) {
if (fw_dump->tmpl_hdr == NULL || if (fw_dump->tmpl_hdr == NULL ||
adapter->fw_version > prev_fw_version) { adapter->fw_version > prev_fw_version) {
if (fw_dump->tmpl_hdr)
vfree(fw_dump->tmpl_hdr); vfree(fw_dump->tmpl_hdr);
if (!qlcnic_fw_cmd_get_minidump_temp(adapter)) if (!qlcnic_fw_cmd_get_minidump_temp(adapter))
dev_info(&pdev->dev, dev_info(&pdev->dev,
...@@ -2374,12 +2371,11 @@ void qlcnic_free_tx_rings(struct qlcnic_adapter *adapter) ...@@ -2374,12 +2371,11 @@ void qlcnic_free_tx_rings(struct qlcnic_adapter *adapter)
for (ring = 0; ring < adapter->drv_tx_rings; ring++) { for (ring = 0; ring < adapter->drv_tx_rings; ring++) {
tx_ring = &adapter->tx_ring[ring]; tx_ring = &adapter->tx_ring[ring];
if (tx_ring && tx_ring->cmd_buf_arr != NULL) { if (tx_ring) {
vfree(tx_ring->cmd_buf_arr); vfree(tx_ring->cmd_buf_arr);
tx_ring->cmd_buf_arr = NULL; tx_ring->cmd_buf_arr = NULL;
} }
} }
if (adapter->tx_ring != NULL)
kfree(adapter->tx_ring); kfree(adapter->tx_ring);
} }
...@@ -2758,12 +2754,8 @@ static void qlcnic_remove(struct pci_dev *pdev) ...@@ -2758,12 +2754,8 @@ static void qlcnic_remove(struct pci_dev *pdev)
} }
qlcnic_dcb_free(adapter->dcb); qlcnic_dcb_free(adapter->dcb);
qlcnic_detach(adapter); qlcnic_detach(adapter);
if (adapter->npars != NULL)
kfree(adapter->npars); kfree(adapter->npars);
if (adapter->eswitch != NULL)
kfree(adapter->eswitch); kfree(adapter->eswitch);
if (qlcnic_82xx_check(adapter)) if (qlcnic_82xx_check(adapter))
...@@ -2932,13 +2924,13 @@ void qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter) ...@@ -2932,13 +2924,13 @@ void qlcnic_alloc_lb_filters_mem(struct qlcnic_adapter *adapter)
static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter) static void qlcnic_free_lb_filters_mem(struct qlcnic_adapter *adapter)
{ {
if (adapter->fhash.fmax && adapter->fhash.fhead) if (adapter->fhash.fmax)
kfree(adapter->fhash.fhead); kfree(adapter->fhash.fhead);
adapter->fhash.fhead = NULL; adapter->fhash.fhead = NULL;
adapter->fhash.fmax = 0; adapter->fhash.fmax = 0;
if (adapter->rx_fhash.fmax && adapter->rx_fhash.fhead) if (adapter->rx_fhash.fmax)
kfree(adapter->rx_fhash.fhead); kfree(adapter->rx_fhash.fhead);
adapter->rx_fhash.fmax = 0; adapter->rx_fhash.fmax = 0;
......
...@@ -1407,7 +1407,6 @@ void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter) ...@@ -1407,7 +1407,6 @@ void qlcnic_83xx_get_minidump_template(struct qlcnic_adapter *adapter)
current_version = qlcnic_83xx_get_fw_version(adapter); current_version = qlcnic_83xx_get_fw_version(adapter);
if (fw_dump->tmpl_hdr == NULL || current_version > prev_version) { if (fw_dump->tmpl_hdr == NULL || current_version > prev_version) {
if (fw_dump->tmpl_hdr)
vfree(fw_dump->tmpl_hdr); vfree(fw_dump->tmpl_hdr);
if (!qlcnic_fw_cmd_get_minidump_temp(adapter)) if (!qlcnic_fw_cmd_get_minidump_temp(adapter))
dev_info(&pdev->dev, "Supports FW dump capability\n"); dev_info(&pdev->dev, "Supports FW dump capability\n");
......
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