Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753121AbbLNRhJ (ORCPT ); Mon, 14 Dec 2015 12:37:09 -0500 Received: from mail.osadl.at ([92.243.35.153]:48505 "EHLO mail.osadl.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752745AbbLNRhH (ORCPT ); Mon, 14 Dec 2015 12:37:07 -0500 Date: Mon, 14 Dec 2015 17:36:31 +0000 From: Nicholas Mc Guire To: "Marciniszyn, Mike" Cc: Nicholas Mc Guire , Doug Ledford , "Hefty, Sean" , Hal Rosenstock , Greg Kroah-Hartman , "linux-rdma@vger.kernel.org" , "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/3] staging/rdma/hfi1: check return value of kcalloc Message-ID: <20151214173631.GA22987@osadl.at> References: <1450104189-2653-1-git-send-email-hofrat@osadl.org> <1450104189-2653-2-git-send-email-hofrat@osadl.org> <32E1700B9017364D9B60AED9960492BC259CD79F@fmsmsx120.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <32E1700B9017364D9B60AED9960492BC259CD79F@fmsmsx120.amr.corp.intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1238 Lines: 43 On Mon, Dec 14, 2015 at 03:21:24PM +0000, Marciniszyn, Mike wrote: > > @@ -10129,6 +10129,9 @@ static void init_qos(struct hfi1_devdata *dd, > > u32 first_ctxt) > > if (num_vls * qpns_per_vl > dd->chip_rcv_contexts) > > goto bail; > > rsmmap = kcalloc(NUM_MAP_REGS, sizeof(u64), GFP_KERNEL); > > + if (!rsmmap) > > + goto bail; > > + > > I checked out a linux-next remote at the next-20151214 tag. > > The allocation method is clearly kmalloc_array() not kcalloc(). > > Where are you seeing the kcalloc()? > > While it is tempting to allocate and zero, there is a chip rev specific difference. > x = kmalloc_array(...) if(!x) ... memset(x...) should be equivalent to kcalloc - include/linux/slab.h static inline void *kcalloc(size_t n, size_t size, gfp_t flags) { return kmalloc_array(n, size, flags | __GFP_ZERO); } if the assumption that this is equvalent is wrong I appologize the intent was simply API consolidation as the patch description stated. thx! hofrta -- 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/