mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-10-23 07:34:24 +02:00
ANDROID: Snapshot Mainline's version of checkpatch.pl
Nothing fancy here. Keeping full history is not required. `git checkout mainline/master -- scripts/checkpatch.pl` This may need to be done periodically. Bug: 316492624 Signed-off-by: Lee Jones <joneslee@google.com> Change-Id: I4c90b50197ca7277c59e96bf332ecf795c4f3d12
This commit is contained in:
parent
011eb465ff
commit
dacc72aa0e
|
@ -512,6 +512,7 @@ our $Attribute = qr{
|
|||
__ro_after_init|
|
||||
__kprobes|
|
||||
$InitAttribute|
|
||||
__aligned\s*\(.*\)|
|
||||
____cacheline_aligned|
|
||||
____cacheline_aligned_in_smp|
|
||||
____cacheline_internodealigned_in_smp|
|
||||
|
@ -4054,7 +4055,7 @@ sub process {
|
|||
if ($prevline =~ /^[\+ ]};?\s*$/ &&
|
||||
$line =~ /^\+/ &&
|
||||
!($line =~ /^\+\s*$/ ||
|
||||
$line =~ /^\+\s*(?:EXPORT_SYMBOL|early_param)/ ||
|
||||
$line =~ /^\+\s*(?:EXPORT_SYMBOL|early_param|ALLOW_ERROR_INJECTION)/ ||
|
||||
$line =~ /^\+\s*MODULE_/i ||
|
||||
$line =~ /^\+\s*\#\s*(?:end|elif|else)/ ||
|
||||
$line =~ /^\+[a-z_]*init/ ||
|
||||
|
@ -6427,15 +6428,6 @@ sub process {
|
|||
}
|
||||
}
|
||||
|
||||
# check for soon-to-be-deprecated single-argument k[v]free_rcu() API
|
||||
if ($line =~ /\bk[v]?free_rcu\s*\([^(]+\)/) {
|
||||
if ($line =~ /\bk[v]?free_rcu\s*\([^,]+\)/) {
|
||||
ERROR("DEPRECATED_API",
|
||||
"Single-argument k[v]free_rcu() API is deprecated, please pass rcu_head object or call k[v]free_rcu_mightsleep()." . $herecurr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# check for unnecessary "Out of Memory" messages
|
||||
if ($line =~ /^\+.*\b$logFunctions\s*\(/ &&
|
||||
$prevline =~ /^[ \+]\s*if\s*\(\s*(\!\s*|NULL\s*==\s*)?($Lval)(\s*==\s*NULL\s*)?\s*\)/ &&
|
||||
|
@ -7020,6 +7012,25 @@ sub process {
|
|||
"Prefer strscpy, strscpy_pad, or __nonstring over strncpy - see: https://github.com/KSPP/linux/issues/90\n" . $herecurr);
|
||||
}
|
||||
|
||||
# ethtool_sprintf uses that should likely be ethtool_puts
|
||||
if ($line =~ /\bethtool_sprintf\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
|
||||
if (WARN("PREFER_ETHTOOL_PUTS",
|
||||
"Prefer ethtool_puts over ethtool_sprintf with only two arguments\n" . $herecurr) &&
|
||||
$fix) {
|
||||
$fixed[$fixlinenr] =~ s/\bethtool_sprintf\s*\(\s*($FuncArg)\s*,\s*($FuncArg)/ethtool_puts($1, $7)/;
|
||||
}
|
||||
}
|
||||
|
||||
# use $rawline because $line loses %s via sanitization and thus we can't match against it.
|
||||
if ($rawline =~ /\bethtool_sprintf\s*\(\s*$FuncArg\s*,\s*\"\%s\"\s*,\s*$FuncArg\s*\)/) {
|
||||
if (WARN("PREFER_ETHTOOL_PUTS",
|
||||
"Prefer ethtool_puts over ethtool_sprintf with standalone \"%s\" specifier\n" . $herecurr) &&
|
||||
$fix) {
|
||||
$fixed[$fixlinenr] =~ s/\bethtool_sprintf\s*\(\s*($FuncArg)\s*,\s*"\%s"\s*,\s*($FuncArg)/ethtool_puts($1, $7)/;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# typecasts on min/max could be min_t/max_t
|
||||
if ($perl_version_ok &&
|
||||
defined $stat &&
|
||||
|
|
Loading…
Reference in New Issue
Block a user