From: Greg Kroah-Hartman Date: Mon, 14 Apr 2008 21:17:29 +0000 (-0700) Subject: checkpatch: usb_free_urb() can take NULL X-Git-Tag: v2.6.26-rc1~1061^2~110 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2010a3b9e5e98efb7f70d4d73ce4f15508ffa7b;p=linux-2.6 checkpatch: usb_free_urb() can take NULL usb_free_urb() can take a NULL, so let's check and warn about that. Signed-off-by: Greg Kroah-Hartman --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 58a94947d6..64ec4b8a51 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1889,6 +1889,13 @@ sub process { WARN("kfree(NULL) is safe this check is probabally not required\n" . $hereprev); } } +# check for needless usb_free_urb() checks + if ($prevline =~ /\bif\s*\(([^\)]*)\)/) { + my $expr = $1; + if ($line =~ /\busb_free_urb\(\Q$expr\E\);/) { + WARN("usb_free_urb(NULL) is safe this check is probabally not required\n" . $hereprev); + } + } # warn about #ifdefs in C files # if ($line =~ /^.#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {