Commit d0110443 authored by Bragatheswaran Manickavel's avatar Bragatheswaran Manickavel Committed by David S. Miller

amd/pds_core: core: No need for Null pointer check before kfree

kfree()/vfree() internally perform NULL check on the
pointer handed to it and take no action if it indeed is
NULL. Hence there is no need for a pre-check of the memory
pointer before handing it to kfree()/vfree().

Issue reported by ifnullfree.cocci Coccinelle semantic
patch script.
Signed-off-by: default avatarBragatheswaran Manickavel <bragathemanick0908@gmail.com>
Reviewed-by: default avatarShannon Nelson <shannon.nelson@amd.com>
Reviewed-by: default avatarWojciech Drewek <wojciech.drewek@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 61450abf
...@@ -152,11 +152,8 @@ void pdsc_qcq_free(struct pdsc *pdsc, struct pdsc_qcq *qcq) ...@@ -152,11 +152,8 @@ void pdsc_qcq_free(struct pdsc *pdsc, struct pdsc_qcq *qcq)
dma_free_coherent(dev, qcq->cq_size, dma_free_coherent(dev, qcq->cq_size,
qcq->cq_base, qcq->cq_base_pa); qcq->cq_base, qcq->cq_base_pa);
if (qcq->cq.info) vfree(qcq->cq.info);
vfree(qcq->cq.info); vfree(qcq->q.info);
if (qcq->q.info)
vfree(qcq->q.info);
memset(qcq, 0, sizeof(*qcq)); memset(qcq, 0, sizeof(*qcq));
} }
......
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