lkml.org 
[lkml]   [2017]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] checkpatch: add warning on %pk instead of %pK usage
    Date
    From: William Roberts <william.c.roberts@intel.com>

    Sample output:
    WARNING: %pk is close to %pK, did you mean %pK?.
    \#20: FILE: drivers/char/applicom.c:230:
    + printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device. %pk\n", dev->irq, pci_get_class);

    Signed-off-by: William Roberts <william.c.roberts@intel.com>
    ---
    scripts/checkpatch.pl | 6 ++++++
    1 file changed, 6 insertions(+)

    diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
    index 982c52c..f20f5c5 100755
    --- a/scripts/checkpatch.pl
    +++ b/scripts/checkpatch.pl
    @@ -6096,6 +6096,12 @@ sub process {
    "recursive locking is bad, do not use this ever.\n" . $herecurr);
    }

    +# check for bad %pK usage
    + if ($rawline =~ /\%pk/) {
    + WARN("FORMAT SPECIFIER",
    + "%pk is close to %pK, did you mean %pK?.\n" . $herecurr);
    + }
    +
    # check for lockdep_set_novalidate_class
    if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
    $line =~ /__lockdep_no_validate__\s*\)/ ) {
    --
    2.7.4
    \
     
     \ /
      Last update: 2017-02-10 20:38    [W:2.429 / U:0.096 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site