From: Ziyang Xuan Date: Fri, 13 May 2022 07:29:28 +0000 (+0800) Subject: octeon_ep: delete unnecessary NULL check X-Git-Tag: v6.6.17~7459^2~100 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1dee43c2c6f159c26684e02a56373bb3b537ab24;p=platform%2Fkernel%2Flinux-rpi.git octeon_ep: delete unnecessary NULL check vfree(NULL) is safe. NULL check before vfree() is not needed. Delete them to simplify the code. Signed-off-by: Ziyang Xuan Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c index ebf78f6..94409e3 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c @@ -980,8 +980,7 @@ static void octep_device_cleanup(struct octep_device *oct) dev_info(&oct->pdev->dev, "Cleaning up Octeon Device ...\n"); for (i = 0; i < OCTEP_MAX_VF; i++) { - if (oct->mbox[i]) - vfree(oct->mbox[i]); + vfree(oct->mbox[i]); oct->mbox[i] = NULL; } diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c b/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c index 945947e..d9ae093 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_rx.c @@ -230,8 +230,7 @@ static int octep_free_oq(struct octep_oq *oq) octep_oq_free_ring_buffers(oq); - if (oq->buff_info) - vfree(oq->buff_info); + vfree(oq->buff_info); if (oq->desc_ring) dma_free_coherent(oq->dev, diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c index 511552b..5a520d3 100644 --- a/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_tx.c @@ -270,8 +270,7 @@ static void octep_free_iq(struct octep_iq *iq) desc_ring_size = OCTEP_IQ_DESC_SIZE * CFG_GET_IQ_NUM_DESC(oct->conf); - if (iq->buff_info) - vfree(iq->buff_info); + vfree(iq->buff_info); if (iq->desc_ring) dma_free_coherent(iq->dev, desc_ring_size,