From patchwork Thu Sep 21 06:15:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Meyer X-Patchwork-Id: 9963333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AEDD86020C for ; Thu, 21 Sep 2017 06:25:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0ABE27F60 for ; Thu, 21 Sep 2017 06:25:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 958AD285BD; Thu, 21 Sep 2017 06:25:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 24A6327F60 for ; Thu, 21 Sep 2017 06:25:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751698AbdIUGX3 (ORCPT ); Thu, 21 Sep 2017 02:23:29 -0400 Received: from www17.your-server.de ([213.133.104.17]:59853 "EHLO www17.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751484AbdIUGX2 (ORCPT ); Thu, 21 Sep 2017 02:23:28 -0400 Received: from [95.222.26.195] (helo=olymp) by www17.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1duutS-0002sY-VO; Thu, 21 Sep 2017 08:23:27 +0200 Subject: [PATCH 3/6] scsi: lpfc: Cocci spatch "pool_zalloc-simple" From: Thomas Meyer To: james.smart@broadcom.com, dick.kennedy@broadcom.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Mime-Version: 1.0 Message-ID: <1505974468535-735692655-3-diffsplit-thomas@m3y3r.de> References: <1505974468535-2047238743-0-diffsplit-thomas@m3y3r.de> In-Reply-To: <1505974468535-2047238743-0-diffsplit-thomas@m3y3r.de> Date: Thu, 21 Sep 2017 08:15:26 +0200 X-Mailer: Evolution 3.22.6-1 X-Authenticated-Sender: thomas@m3y3r.de X-Virus-Scanned: Clear (ClamAV 0.99.2/23858/Thu Sep 21 02:46:36 2017) Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0. Found by coccinelle spatch "api/alloc/pool_zalloc-simple.cocci" Signed-off-by: Thomas Meyer Signed-off-by: James Smart diff -u -p a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -1938,14 +1938,13 @@ lpfc_new_nvme_buf(struct lpfc_vport *vpo * pci bus space for an I/O. The DMA buffer includes the * number of SGE's necessary to support the sg_tablesize. */ - lpfc_ncmd->data = dma_pool_alloc(phba->lpfc_sg_dma_buf_pool, - GFP_KERNEL, - &lpfc_ncmd->dma_handle); + lpfc_ncmd->data = dma_pool_zalloc(phba->lpfc_sg_dma_buf_pool, + GFP_KERNEL, + &lpfc_ncmd->dma_handle); if (!lpfc_ncmd->data) { kfree(lpfc_ncmd); break; } - memset(lpfc_ncmd->data, 0, phba->cfg_sg_dma_buf_size); lxri = lpfc_sli4_next_xritag(phba); if (lxri == NO_XRI) {