Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1591021imm; Thu, 12 Jul 2018 04:43:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfWSaAuvjZF6F6acy+2XNcYs4zvtK5+4v1owrLZZ7e1BAH5j6aqAgy5UJEbZZajhKQAw47v X-Received: by 2002:a63:1811:: with SMTP id y17-v6mr1790336pgl.356.1531395831658; Thu, 12 Jul 2018 04:43:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531395831; cv=none; d=google.com; s=arc-20160816; b=LVdKsUOvW1/4Javsq/foLo8Enw/q4+1hIvJrxev97UrDOuTSVlxJBrC2EHd1qc12RG 4EaCkvPFs0VYhE4xMi1TnsJqLUaAChTKAklgrYYgGsZP64LC2uApmp0ByfHguEi/98U8 QWcXwv5K6q6d/P60FgZCgkxYhq1G3KmWovHavuqEQcOTviALkU55GQOhsUEJgC1PFPDd Uqooneuh4YprvyHp7q9dXpUvgO9cHBsBjgSND38UHLBzSHi6btAfjOXKa+UiCybMej0u Bkhzm+JXr1whYQrlO0aa5jA69cJjG/fJAtXFwerBz0aWAddFPDCeHdaYWz0mrjekQcyI UbHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=GWCnE4XLO94EGLzXXq6qe9iCogYHx+8v3kWsPqTzVAM=; b=oGME2gZbqQYyQ4iVs+qsiMY485+P08Bb8TIFp044TO+If24Ylc8kthqszUQDgALWEG m5jXiENpOb7QFfLZocwNbrY5dE1kW5V580iaf71gq0QGWgBWTikoyXNSUkxKJHoH0DcS GDpuTmziPBLqceG0HfD5hA9lDLESS3KDqGNvij4EMn54HM6pu8TwUTelryMhcVNPvy3B f7eK2lNqTOv4WtbCOG5emWnL5feMZLvslLqNXYCzINgo8iD8l1K0Csa4qAoCKRFC+NBS uok1q+8yE/p1cSrP2uPQzOhvWukCYVEcdJ3I/JI1GEkNql1kTMWRYgofs/tgmox/jB3s uSzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=xxKxnAeo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z77-v6si23051022pff.100.2018.07.12.04.43.36; Thu, 12 Jul 2018 04:43:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=xxKxnAeo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbeGLLvH (ORCPT + 99 others); Thu, 12 Jul 2018 07:51:07 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:53179 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726768AbeGLLuz (ORCPT ); Thu, 12 Jul 2018 07:50:55 -0400 Received: by mail-wm0-f67.google.com with SMTP id w16-v6so5328643wmc.2 for ; Thu, 12 Jul 2018 04:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GWCnE4XLO94EGLzXXq6qe9iCogYHx+8v3kWsPqTzVAM=; b=xxKxnAeo1Gij3N/PTWZC1RiPqIOF5Swl4FZsm7mDCz4LNsMpirWpy9EJlxtEW3ADZI E0UV9Fkf7FsLzn0+nrxr6tbYvLVJAXdC+iPs/RVk03h+VQtjfOoWMikU6shz2FvmacYG r3qi4sVHRRVaGA8kO2HfdJo/I4mUoGGDTdwx5S59CZoPoem/dI/muON4AWrB5fhsr47l NfJpQiwUE9p+2aA1vL3e7qKxYxPU0dJ1qyV2XRu7YdBP/tobgxqx0zr2uKuZX8Vgy3PJ I3mKkxYtRxnQmXE9CtbwekwDxyiA0jmetbpH6QP69r1Yczl3c9iULA2H81tcgT02uOMr IlzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GWCnE4XLO94EGLzXXq6qe9iCogYHx+8v3kWsPqTzVAM=; b=JGps6OhrFix2BwwmcE5QF12qAhZCC6Lu4mvyodRVQl30R/OJbm1vpFk4pL806Xc4oh YdByvh5bE7RepKP+E/tful9bgtU/LfHKFeqvfNW5D0OPNJhqor6N37MhY6+/ZnESZsjJ b2FAHWPRSZalktwBZRiDS0ZrP75nFy+ZRX1+gM6G8n+6He68oTBxdCMSXBkfYmtUq4wO npOKWqa0R2eVbUEH8fQDk2gRoTcek7IfRldc63utbAdIDZmPNMube++V/IXrLEncqfl3 cryOJL9i4T+2bQaHszVGtvUXVwUrDE3k9iGETjNeyeouAX4RO6objcSnrDjirkyQjewV 5XUQ== X-Gm-Message-State: AOUpUlEP1mVNwf+ASvWzixR3KGAZh7o0cp7N+JNmbhfiMVMpCPjXIQXJ T/E0gHrdpK/z1Qgcn2t8FRyPPw== X-Received: by 2002:a1c:1748:: with SMTP id 69-v6mr1124265wmx.75.1531395703735; Thu, 12 Jul 2018 04:41:43 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l3-v6sm7716939wrb.34.2018.07.12.04.41.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Jul 2018 04:41:43 -0700 (PDT) From: Corentin Labbe To: hdegoede@redhat.com, tj@kernel.org Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Corentin Labbe Subject: [PATCH 2/3] ata: ahci_platform: convert kzallloc to kcalloc Date: Thu, 12 Jul 2018 11:41:30 +0000 Message-Id: <1531395691-4653-3-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531395691-4653-1-git-send-email-clabbe@baylibre.com> References: <1531395691-4653-1-git-send-email-clabbe@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's better to kcalloc instead of kzalloc(n * sizeof()) Signed-off-by: Corentin Labbe --- drivers/ata/libahci_platform.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 70052c046559..be9f54423a9b 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -351,7 +351,7 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev) struct ahci_host_priv *hpriv; struct clk *clk; struct device_node *child; - int i, sz, enabled_ports = 0, rc = -ENOMEM, child_nodes; + int i, enabled_ports = 0, rc = -ENOMEM, child_nodes; u32 mask_port_map = 0; if (!devres_open_group(dev, NULL, GFP_KERNEL)) @@ -403,14 +403,12 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev) if (!child_nodes) hpriv->nports = 1; - sz = hpriv->nports * sizeof(*hpriv->phys); - hpriv->phys = devm_kzalloc(dev, sz, GFP_KERNEL); + hpriv->phys = devm_kcalloc(dev, hpriv->nports, sizeof(*hpriv->phys), GFP_KERNEL); if (!hpriv->phys) { rc = -ENOMEM; goto err_out; } - sz = hpriv->nports * sizeof(*hpriv->target_pwrs); - hpriv->target_pwrs = kzalloc(sz, GFP_KERNEL); + hpriv->target_pwrs = kcalloc(hpriv->nports, sizeof(*hpriv->target_pwrs), GFP_KERNEL); if (!hpriv->target_pwrs) { rc = -ENOMEM; goto err_out; -- 2.16.4