All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] octeon_ep: delete unnecessary NULL check
@ 2022-05-13  7:29 Ziyang Xuan
  2022-05-16 10:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Ziyang Xuan @ 2022-05-13  7:29 UTC (permalink / raw)
  To: vburru, aayarekar, davem, edumazet, kuba, pabeni, netdev, linux-kernel

vfree(NULL) is safe. NULL check before vfree() is not needed.
Delete them to simplify the code.

Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
---
 drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 3 +--
 drivers/net/ethernet/marvell/octeon_ep/octep_rx.c   | 3 +--
 drivers/net/ethernet/marvell/octeon_ep/octep_tx.c   | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
index e020c81f3455..7e590c572d58 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 945947ec7723..d9ae0937d17a 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 511552bc3e87..5a520d37bea0 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,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] octeon_ep: delete unnecessary NULL check
  2022-05-13  7:29 [PATCH net-next] octeon_ep: delete unnecessary NULL check Ziyang Xuan
@ 2022-05-16 10:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-16 10:50 UTC (permalink / raw)
  To: Ziyang Xuan
  Cc: vburru, aayarekar, davem, edumazet, kuba, pabeni, netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 13 May 2022 15:29:28 +0800 you wrote:
> vfree(NULL) is safe. NULL check before vfree() is not needed.
> Delete them to simplify the code.
> 
> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
> ---
>  drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 3 +--
>  drivers/net/ethernet/marvell/octeon_ep/octep_rx.c   | 3 +--
>  drivers/net/ethernet/marvell/octeon_ep/octep_tx.c   | 3 +--
>  3 files changed, 3 insertions(+), 6 deletions(-)

Here is the summary with links:
  - [net-next] octeon_ep: delete unnecessary NULL check
    https://git.kernel.org/netdev/net-next/c/1dee43c2c6f1

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-16 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13  7:29 [PATCH net-next] octeon_ep: delete unnecessary NULL check Ziyang Xuan
2022-05-16 10:50 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.