1 // SPDX-License-Identifier: GPL-2.0-only
2 /// NULL check before some freeing functions is not needed.
4 /// Based on checkpatch warning
5 /// "kfree(NULL) is safe this check is probably not required"
6 /// and kfreeaddr.cocci by Julia Lawall.
8 // Copyright: (C) 2014 Fabian Frederick.
10 // Options: --no-includes --include-headers
28 debugfs_remove_recursive(E);
32 kmem_cache_destroy(E);
39 @r depends on context || report || org @
45 * \(kfree@p\|kzfree@p\|debugfs_remove@p\|debugfs_remove_recursive@p\|
46 * usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\|
47 * dma_pool_destroy@p\)(E);
49 @script:python depends on org@
53 cocci.print_main("NULL check before that freeing function is not needed", p)
55 @script:python depends on report@
59 msg = "WARNING: NULL check before some freeing functions is not needed."
60 coccilib.report.print_report(p[0], msg)