Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c432a8f authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Linus Torvalds
Browse files

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarAndy Whitcroft <apw@shadowen.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f5fe35dd
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -2078,6 +2078,13 @@ sub process {
				WARN("kfree(NULL) is safe this check is probabally not required\n" . $hereprev);
				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 probably not required\n" . $hereprev);
			}
		}


# warn about #ifdefs in C files
# warn about #ifdefs in C files
#		if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {
#		if ($line =~ /^.\s*\#\s*if(|n)def/ && ($realfile =~ /\.c$/)) {