The "= {};" style empty struct initializer is preferred over = {0}. It avoids the situation where the first struct member is a pointer and that generates a Sparse warning about assigning using zero instead of NULL. Also it's just nicer to look at. Some people complain that {} is less portable but the kernel has different portability requirements from userspace so this is not a issue that we care about. Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> --- scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 461d4221e4a4..32c8a0ca6fd0 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4029,6 +4029,12 @@ sub process { "Using $1 is unnecessary\n" . $herecurr); } +# prefer = {}; to = {0}; + if ($line =~ /= \{ *0 *\}/) { + WARN("ZERO_INITIALIZER", + "= {} is preferred over = {0}\n" . $herecurr); + } + # Check for potential 'bare' types my ($stat, $cond, $line_nr_next, $remain_next, $off_next, $realline_next); -- 2.30.2