From 687941952df1a495cc36f0cae342386572c5ab85 Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Wed, 20 Sep 2023 12:13:14 +0530 Subject: [PATCH] LU-6142 checkpatch: Add check for %zd CWARN() or CERROR() requires a certain format. That is it should start with '%s:' and end with '%d' or '%ld'. Otherwise it will throw an warning. This patch extends checks for type '%zd'. As few return types could be of size_t. Test-Parameters: trivial Signed-off-by: Arshad Hussain Change-Id: Ida4f41af6b8fda0b028daeea18231b2d01905c31 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52421 Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger --- contrib/scripts/checkpatch.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl index b9d5a349..00bf11e 100755 --- a/contrib/scripts/checkpatch.pl +++ b/contrib/scripts/checkpatch.pl @@ -5186,10 +5186,12 @@ sub process { "Console messages should start with '%s:' to print device name\n" . $herecurr) } - # Check for "rc = %d" or "rc = %ld" at the end of errors - if ($line !~ /LCONSOLE/ && $rawline !~ /: rc = \%l?d\\n\",/) { + # Check for "rc = %d" or "rc = %ld" or "rc = %zd" + # at the end of errors + if ($line !~ /LCONSOLE/ && + $rawline !~ /: rc = \%l|z?d\\n\",/) { WARN("CERROR_RET", - "Console messages should end with ': rc = %d' or 'rc = %ld'\n" . $herecurr); + "Console messages should end with ': rc = %[lz]d'\n" . $herecurr); } # This is fine as we are only matching the first part. -- 1.8.3.1