From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============2923956957988418946==" MIME-Version: 1.0 From: kbuild test robot Subject: [PATCH] elx: efct: fix zalloc-simple.cocci warnings Date: Sun, 12 Apr 2020 15:22:57 +0800 Message-ID: <20200412072257.GA19038@9dbb232d854f> In-Reply-To: <202004121504.E6ItoFUo%lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============2923956957988418946== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org In-Reply-To: <20200412033303.29574-32-jsmart2021@gmail.com> References: <20200412033303.29574-32-jsmart2021@gmail.com> TO: James Smart CC: linux-scsi(a)vger.kernel.org CC: dwagner(a)suse.de, maier(a)linux.ibm.com, bvanassche(a)acm.org, herbszt= (a)gmx.de, natechancellor(a)gmail.com, rdunlap(a)infradead.org, hare(a)suse= .de, James Smart , Ram Vegesna From: kbuild test robot drivers/scsi/elx/efct/efct_xport.c:44:9-16: WARNING: kzalloc should be used= for xport, instead of kmalloc/memset drivers/scsi/elx/efct/efct_xport.c:688:12-19: WARNING: kzalloc should be us= ed for payload, instead of kmalloc/memset Use zeroing allocator rather than allocator followed by memset with 0 This considers some simple cases that are common and easy to validate Note in particular that there are no ...s in the rule, so all of the matched code has to be contiguous Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci CC: James Smart Signed-off-by: kbuild test robot --- url: https://github.com/0day-ci/linux/commits/James-Smart/efct-Broadcom-= Emulex-FC-Target-driver/20200412-114125 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-ne= xt :::::: branch date: 4 hours ago :::::: commit date: 4 hours ago efct_xport.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) --- a/drivers/scsi/elx/efct/efct_xport.c +++ b/drivers/scsi/elx/efct/efct_xport.c @@ -41,11 +41,10 @@ efct_xport_alloc(struct efct *efct) { struct efct_xport *xport; = - xport =3D kmalloc(sizeof(*xport), GFP_KERNEL); + xport =3D kzalloc(sizeof(*xport), GFP_KERNEL); if (!xport) return xport; = - memset(xport, 0, sizeof(*xport)); xport->efct =3D efct; return xport; } @@ -685,12 +684,10 @@ efct_xport_control(struct efct_xport *xp context =3D va_arg(argp, void *); va_end(argp); = - payload =3D kmalloc(sizeof(*payload), GFP_KERNEL); + payload =3D kzalloc(sizeof(*payload), GFP_KERNEL); if (!payload) return EFC_FAIL; = - memset(payload, 0, sizeof(*payload)); - efct =3D node->efc->base; hw =3D &efct->hw; =20 --===============2923956957988418946==--