Skip to content
Commit cb2a2ebd authored by Heinrich Schuchardt's avatar Heinrich Schuchardt Committed by Tom Rini
Browse files

coccinelle: check for casting malloc output



Casting the (void *) output of memory allocation functions before
assignment like in

	sata->cmd_hdr_tbl_offset = (void *)malloc(length + align);

is useless.

Adopt the Linux kernel script
scripts/coccinelle/api/alloc/alloc_cast.cocci.

Now 'make coccicheck' generates warnings like:

./drivers/ata/fsl_sata.c:143:29-33:
WARNING: casting value returned by memory allocation function
to (void *) is useless.

Signed-off-by: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
parent b5a20463
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment