1 /// NULL check before some freeing functions is not needed.
3 /// Based on checkpatch warning
4 /// "kfree(NULL) is safe this check is probably not required"
5 /// and kfreeaddr.cocci by Julia Lawall.
7 // Copyright: (C) 2014 Fabian Frederick. GPLv2.
9 // Options: --no-includes --include-headers
27 - debugfs_remove_recursive(E);
28 + debugfs_remove_recursive(E);
34 @r depends on context || report || org @
40 * \(kfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|usb_free_urb\)(E);
42 @script:python depends on org@
46 cocci.print_main("NULL check before that freeing function is not needed", p)
48 @script:python depends on report@
52 msg = "WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values."
53 coccilib.report.print_report(p[0], msg)