Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: line6: fix ifnullfree.cocci warnings

sound/usb/line6/driver.c:484:2-7: 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.

NULL check before some freeing functions is not needed.

Based on checkpatch warning
"kfree(NULL) is safe this check is probably not required"
and kfreeaddr.cocci by Julia Lawall.

Generated by: scripts/coccinelle/free/ifnullfree.cocci

CC: Andrej Krutak <dev@andree.sk>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

authored by

kbuild test robot and committed by
Takashi Iwai
a4bc746c a16039cb

+1 -2
+1 -2
sound/usb/line6/driver.c
··· 480 480 /* Free buffer memory first. We cannot depend on the existence of private 481 481 * data from the (podhd) module, it may be gone already during this call 482 482 */ 483 - if (line6->buffer_message) 484 - kfree(line6->buffer_message); 483 + kfree(line6->buffer_message); 485 484 486 485 kfree(line6->buffer_listen); 487 486