Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752138AbbLNOw0 (ORCPT ); Mon, 14 Dec 2015 09:52:26 -0500 Received: from www.osadl.org ([62.245.132.105]:42849 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750930AbbLNOwZ (ORCPT ); Mon, 14 Dec 2015 09:52:25 -0500 From: Nicholas Mc Guire To: Mike Marciniszyn Cc: Doug Ledford , Sean Hefty , Hal Rosenstock , Greg Kroah-Hartman , linux-rdma@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH 1/3] staging/rdma/hfi1: consolidate kmalloc_array+memset into kcalloc Date: Mon, 14 Dec 2015 15:43:07 +0100 Message-Id: <1450104189-2653-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1357 Lines: 36 rather than using kmalloc_array + memset it seems cleaner to simply use kcalloc which will deliver memory set to zero. Signed-off-by: Nicholas Mc Guire --- Patch was compile tested with: x86_64_defconfig CONFIG_INFINIBAND=m, CONFIG_STAGING=y, CONFIG_STAGING_RDMA=m Patch is against linux-next (localversion-next is -next-20151214) drivers/staging/rdma/hfi1/chip.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index dc69159..31eec8a 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -10128,8 +10128,7 @@ static void init_qos(struct hfi1_devdata *dd, u32 first_ctxt) goto bail; if (num_vls * qpns_per_vl > dd->chip_rcv_contexts) goto bail; - rsmmap = kmalloc_array(NUM_MAP_REGS, sizeof(u64), GFP_KERNEL); - memset(rsmmap, rxcontext, NUM_MAP_REGS * sizeof(u64)); + rsmmap = kcalloc(NUM_MAP_REGS, sizeof(u64), GFP_KERNEL); /* init the local copy of the table */ for (i = 0, ctxt = first_ctxt; i < num_vls; i++) { unsigned tctxt; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/