]> git.droids-corp.org - dpdk.git/commit
devtools: add script to fix unnecessary null checks
authorStephen Hemminger <stephen@networkplumber.org>
Wed, 9 Feb 2022 19:17:14 +0000 (11:17 -0800)
committerThomas Monjalon <thomas@monjalon.net>
Sat, 12 Feb 2022 11:06:31 +0000 (12:06 +0100)
commit27b360f1b561eb12b5e0383a2d2bb7f5c77b7505
tree61f1117bec969ae86042b1fd7c03b34daa753845
parente7b1c4665fd02259d5bd43213fa9b8565d25a169
devtools: add script to fix unnecessary null checks

This script is based on the idea of the nullfree script
in the Linux kernel. It finds cases where a check for null
pointer is done, but is unnecessary because the function
already handles NULL pointer.

Basic example:
       if (x->buf)
           rte_free(x->buf);
can be reduced to:
       rte_free(x->buf);

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
devtools/cocci/nullfree.cocci [new file with mode: 0644]