Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4020088pxa; Sun, 9 Aug 2020 20:51:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybsy+XU3UP+DzSqEYPsEpj1m4WmNk8j8HhGnuMgxFsiu4bVXSIGd/bybY2RboCT0C+FzWb X-Received: by 2002:a17:906:5a93:: with SMTP id l19mr4150665ejq.418.1597031477966; Sun, 09 Aug 2020 20:51:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597031477; cv=none; d=google.com; s=arc-20160816; b=YGKCZURI+miJaUkLU6FylxOcyVTdDDj7orcrcqi5dQnjzTQziEoNYhCbE98kMeyl3c 1kWnDr+U34RWPrfGbSZJod0XSEwPW0lc3v84GrwFenCYsuqB0HE77WRlA65ubcNXHnnj 6Mp7NuFPGJUjEVLbSb5ZbGRSCU5/jE7iOHSkVE3QFY2JnBUTiwfOGod4yC2GWuHDAZFS J9UjKLROSA0qyx5Y6ZOs281ydV+oP4y6sOLF+5CRuNurAj2NJFLMosKRjITs5YPSUbAa WeBPgJtlLJUjYHYDq2eINewDDb9Kznl2bJUb3qhpwW3JPVoFB/o1KdgbTUoU9Z3Q3/9i oJ3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=cmRFdnEKW2cmEvuqp59fJ6fyMLbaBOiFPwb8NljC60Y=; b=A4FphMJtxOa+3E5XWRbwVeX3SnhdGVZ6EHX06KAJGK8wUZEMchYkB9WucLYaHyOAQA oAvRSGpX0h20BNrpR51NQVU6mwE0zi9m7aze72/vo8MrPFAt1DTv6vgqru6qzW0B16Mf IL/JTYFNuie4ZZ2sG9bYl7DDUcYUm2V+5+YvJTBGh1cHpghT0hLthxZEkCoisbWZ3/E+ 3EKdHyFALbryHIhBsZ0kW6irmPClo5j14EU+GruRDDIFIicNWA4lhYMBfrf3zXS53Euc ji/iFy38EEApsUIam8ORa56VyJctqRnB0BTmRFx83b4SHS7ba72K47stowM7xorqXYZ5 1OFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@pensando.io header.s=google header.b=WLzsoYHu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m27si9765588edj.262.2020.08.09.20.50.53; Sun, 09 Aug 2020 20:51:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@pensando.io header.s=google header.b=WLzsoYHu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726481AbgHJDuG (ORCPT + 99 others); Sun, 9 Aug 2020 23:50:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbgHJDuF (ORCPT ); Sun, 9 Aug 2020 23:50:05 -0400 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BDEAC061786 for ; Sun, 9 Aug 2020 20:50:05 -0700 (PDT) Received: by mail-pl1-x642.google.com with SMTP id k13so4086071plk.13 for ; Sun, 09 Aug 2020 20:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=cmRFdnEKW2cmEvuqp59fJ6fyMLbaBOiFPwb8NljC60Y=; b=WLzsoYHuFkh2cVaLTuqqjBq7blLnA1X5UVbvITM/8GD1fRwyZc2bwEkuEzBPqXJo8g l9QT14DgVrnrq3ajQYOXad12UMvyWt/jyNbaCpk0LsTwFkyvM43wI7mitPgisWAIY5Lm 7X28LeYPYfNtp4gkm3g3IlvcU4LxgNGSFbUgsRsvi2OQjSCWaWbgNNi7yJSbSnUEyFmm 9xbFyC4GkcfTgireDa1q5cQijiDyKYEht64xD/MJ/YSrbW0nA2Xu5JlGLCMX9/4NX+5N 5BMFJJDFOzsobSIrDm2Xrazo8iKFGL002M48vR2dT9cgzTMuFQUWXZDHqUod3VMD0lON 9evA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=cmRFdnEKW2cmEvuqp59fJ6fyMLbaBOiFPwb8NljC60Y=; b=jla2zTVsByYimXAkzXDvCyNHR9YhelcaflWDVUv2RhOIxdBtqGk2+jTZbUl1nhcOby TXAe+R+nRd+FnPv7qDX0kMAvoZ7eqeAfE/f0iMOw0xNBROJOSG7lXcJVAUMIo86v+pUI yJ9P5tnyjVoXswjuyCHMa3boqnjEKFACBRvCSLUdVBQ+rJpWt3LL8gRCtA0aIHkjmrv1 GaCn3vYIqPYwj1zhUx7urSXYI84sQmonu8GEjPDjqMDxNVDhHdCxqJnTRwDxAYsimhFX 65EjlHMVI9PPez4XJ8g63cj0rPJ0200TqCy+NAehALGxR4x+d9qlRGUisu5Ud02Ik4AL yeQw== X-Gm-Message-State: AOAM5301mNxphC1v29si0QTUi2fxxKkfSxwpv1e31a9efexfzov0vw5T y6eElRD5Ks1Y1lzO3dZ5PYQ+gn18HIo= X-Received: by 2002:a17:90a:c781:: with SMTP id gn1mr23952101pjb.151.1597031403585; Sun, 09 Aug 2020 20:50:03 -0700 (PDT) Received: from Shannons-MacBook-Pro.local (static-50-53-47-17.bvtn.or.frontiernet.net. [50.53.47.17]) by smtp.gmail.com with ESMTPSA id bj18sm17391208pjb.5.2020.08.09.20.50.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Aug 2020 20:50:03 -0700 (PDT) Subject: Re: [PATCH] ionic_lif: Use devm_kcalloc() in ionic_qcq_alloc() To: Joe Perches , Xu Wang , drivers@pensando.io, davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org References: <20200810023807.9260-1-vulab@iscas.ac.cn> <4265227298e8d0a943ca4468a4f32222317df197.camel@perches.com> From: Shannon Nelson Message-ID: <2623670b-09f0-2ab4-d618-e478d98c186a@pensando.io> Date: Sun, 9 Aug 2020 20:50:01 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <4265227298e8d0a943ca4468a4f32222317df197.camel@perches.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/9/20 8:20 PM, Joe Perches wrote: > On Mon, 2020-08-10 at 02:38 +0000, Xu Wang wrote: >> A multiplication for the size determination of a memory allocation >> indicated that an array data structure should be processed. >> Thus use the corresponding function "devm_kcalloc". > [] >> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/ethernet/pensando/ionic/ionic_lif.c > [] >> @@ -412,7 +412,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, unsigned int type, >> >> new->flags = flags; >> >> - new->q.info = devm_kzalloc(dev, sizeof(*new->q.info) * num_descs, >> + new->q.info = devm_kcalloc(dev, num_descs, sizeof(*new->q.info), >> GFP_KERNEL); >> if (!new->q.info) { >> netdev_err(lif->netdev, "Cannot allocate queue info\n"); > You could also remove these unnecessary allocation error messages. > There is an existing dump_stack() on allocation failure. > Yes, the dump_stack() tells you which function had the allocation failure, but since there are multiple allocation operations in this same function, I find these helpful in knowing quickly which one of the allocations failed, without having to track down the symbols and source for whatever distro's kernel this might have happened in. sln