From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Sun, 26 Apr 2020 07:27:24 -0400 Subject: [PATCH] coccinelle: check for casting malloc output In-Reply-To: <20200419090734.15928-1-xypron.glpk@gmx.de> References: <20200419090734.15928-1-xypron.glpk@gmx.de> Message-ID: <20200426112724.GA4555@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sun, Apr 19, 2020 at 11:07:34AM +0200, Heinrich Schuchardt wrote: > 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: Heinrich Schuchardt Applied to u-boot/master, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: