DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test: remove unneeded null check before free
@ 2026-10-02 17:17 Stephen Hemminger
  2026-10-03  7:25 ` Marat Khalili
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2026-10-02 17:17 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

Found by devtools/null_free.cocci.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 app/test/test_cksum.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/app/test/test_cksum.c b/app/test/test_cksum.c
index 73f2511731..d94539820a 100644
--- a/app/test/test_cksum.c
+++ b/app/test/test_cksum.c
@@ -320,8 +320,7 @@ test_l4_cksum_mbuf_chain(struct rte_mempool *pktmbuf_pool, const char *pktdata,
 	return 0;
 
 fail:
-	if (m_hdr)
-		rte_pktmbuf_free(m_hdr);
+	rte_pktmbuf_free(m_hdr);
 
 	return -1;
 }
-- 
2.53.0


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

* Re: [PATCH] test: remove unneeded null check before free
  2026-10-02 17:17 [PATCH] test: remove unneeded null check before free Stephen Hemminger
@ 2026-10-03  7:25 ` Marat Khalili
  2026-10-03 16:00   ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Marat Khalili @ 2026-10-03  7:25 UTC (permalink / raw)
  To: Stephen Hemminger, dev

On 02/10/2026 18:17, Stephen Hemminger wrote:
> Found by devtools/null_free.cocci.

nit: should the commit message quote specific coccinelle output being 
fixed?

> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>   app/test/test_cksum.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/app/test/test_cksum.c b/app/test/test_cksum.c
> index 73f2511731..d94539820a 100644
> --- a/app/test/test_cksum.c
> +++ b/app/test/test_cksum.c
> @@ -320,8 +320,7 @@ test_l4_cksum_mbuf_chain(struct rte_mempool *pktmbuf_pool, const char *pktdata,
>   	return 0;
>   
>   fail:
> -	if (m_hdr)
> -		rte_pktmbuf_free(m_hdr);
> +	rte_pktmbuf_free(m_hdr);
>   
>   	return -1;
>   }

Acked-by: Marat Khalili <qm2k21@gmail.com>


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

* Re: [PATCH] test: remove unneeded null check before free
  2026-10-03  7:25 ` Marat Khalili
@ 2026-10-03 16:00   ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2026-10-03 16:00 UTC (permalink / raw)
  To: Marat Khalili; +Cc: dev

On Sat, 3 Oct 2026 08:25:40 +0100
Marat Khalili <qm2k21@gmail.com> wrote:

> On 02/10/2026 18:17, Stephen Hemminger wrote:
> > Found by devtools/null_free.cocci.  
> 
> nit: should the commit message quote specific coccinelle output being 
> fixed?


Coccinelle does edit in place on tree.
  ./devtools/cocci.sh ./devtools/cocci/null_free.cocci

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

end of thread, other threads:[~2026-10-03 16:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-02 17:17 [PATCH] test: remove unneeded null check before free Stephen Hemminger
2026-10-03  7:25 ` Marat Khalili
2026-10-03 16:00   ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox