From patchwork Sun Apr 12 15:40:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 11484607 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4388514DD for ; Sun, 12 Apr 2020 15:50:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24476206E5 for ; Sun, 12 Apr 2020 15:50:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbgDLPuG (ORCPT ); Sun, 12 Apr 2020 11:50:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:45784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727068AbgDLPuF (ORCPT ); Sun, 12 Apr 2020 11:50:05 -0400 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4660FC02A1A2 for ; Sun, 12 Apr 2020 08:40:24 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.72,374,1580770800"; d="scan'208";a="345718631" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2020 17:40:22 +0200 Date: Sun, 12 Apr 2020 17:40:22 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: James Smart cc: linux-scsi@vger.kernel.org, dwagner@suse.de, maier@linux.ibm.com, bvanassche@acm.org, herbszt@gmx.de, natechancellor@gmail.com, rdunlap@infradead.org, hare@suse.de, James Smart , Ram Vegesna , kbuild-all@lists.01.org Subject: [PATCH] elx: efct: fix zalloc-simple.cocci warnings Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: kbuild test robot Use zeroing allocator rather than allocator followed by memset with 0 Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci CC: James Smart Signed-off-by: kbuild test robot Signed-off-by: Julia Lawall --- 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-next :::::: 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 = kmalloc(sizeof(*xport), GFP_KERNEL); + xport = kzalloc(sizeof(*xport), GFP_KERNEL); if (!xport) return xport; - memset(xport, 0, sizeof(*xport)); xport->efct = efct; return xport; } @@ -685,12 +684,10 @@ efct_xport_control(struct efct_xport *xp context = va_arg(argp, void *); va_end(argp); - payload = kmalloc(sizeof(*payload), GFP_KERNEL); + payload = kzalloc(sizeof(*payload), GFP_KERNEL); if (!payload) return EFC_FAIL; - memset(payload, 0, sizeof(*payload)); - efct = node->efc->base; hw = &efct->hw;