Skip to content

Commit

Permalink
net-Liquidio: Delete unnecessary checks before the function call "vfree"
Browse files Browse the repository at this point in the history
The vfree() function performs also input parameter validation.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
elfring authored and davem330 committed Jun 29, 2015
1 parent a694717 commit 9686f31
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
11 changes: 3 additions & 8 deletions drivers/net/ethernet/cavium/liquidio/octeon_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,14 +650,12 @@ void octeon_free_device_mem(struct octeon_device *oct)

for (i = 0; i < MAX_OCTEON_OUTPUT_QUEUES; i++) {
/* could check mask as well */
if (oct->droq[i])
vfree(oct->droq[i]);
vfree(oct->droq[i]);
}

for (i = 0; i < MAX_OCTEON_INSTR_QUEUES; i++) {
/* could check mask as well */
if (oct->instr_queue[i])
vfree(oct->instr_queue[i]);
vfree(oct->instr_queue[i]);
}

i = oct->octeon_id;
Expand Down Expand Up @@ -1078,10 +1076,7 @@ octeon_unregister_dispatch_fn(struct octeon_device *oct, u16 opcode,
oct->dispatch.count--;

spin_unlock_bh(&oct->dispatch.lock);

if (dfree)
vfree(dfree);

vfree(dfree);
return retval;
}

Expand Down
4 changes: 1 addition & 3 deletions drivers/net/ethernet/cavium/liquidio/octeon_droq.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,7 @@ int octeon_delete_droq(struct octeon_device *oct, u32 q_no)
dev_dbg(&oct->pci_dev->dev, "%s[%d]\n", __func__, q_no);

octeon_droq_destroy_ring_buffers(oct, droq);

if (droq->recv_buf_list)
vfree(droq->recv_buf_list);
vfree(droq->recv_buf_list);

if (droq->info_base_addr)
cnnic_free_aligned_dma(oct->pci_dev, droq->info_list,
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/ethernet/cavium/liquidio/request_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ int octeon_delete_instr_queue(struct octeon_device *oct, u32 iq_no)
desc_size =
CFG_GET_IQ_INSTR_TYPE(CHIP_FIELD(oct, cn6xxx, conf));

if (iq->request_list)
vfree(iq->request_list);
vfree(iq->request_list);

if (iq->base_addr) {
q_size = iq->max_count * desc_size;
Expand Down

0 comments on commit 9686f31

Please sign in to comment.