From patchwork Thu Jul 12 11:41:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin LABBE X-Patchwork-Id: 942953 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="xxKxnAeo"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41RDYb1Qkdz9s3R for ; Thu, 12 Jul 2018 21:41:55 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727019AbeGLLvD (ORCPT ); Thu, 12 Jul 2018 07:51:03 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:54500 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbeGLLuz (ORCPT ); Thu, 12 Jul 2018 07:50:55 -0400 Received: by mail-wm0-f67.google.com with SMTP id i139-v6so5328339wmf.4 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=TpPsiTqtFm3jhq7YL50R4XV5jKACvH5UYosRJhnK7uSMUD0+/tNPmY2uhPa3tLvECJ vxvu1rM25Olkuw2CzyvdFwTXzG7vSb1zMKDu8iPbeBXPz7bQ+jBieZ3rwgbgm0fdcIVc f4/qXDbbmOYxUeWRrnEMfAJbDUGh+/K5k+kPEBvsKS7nB50UcAqoxJycN3W//EJB810h huc9IstCQLxvW8gK3BHasWjPLWd/LWpdeB6YhwRXHrV9zBlz+/EfyYGk7M/dHV5Gzylz 2VbEGNREh2Fl6yNwmIMFO1SSvXmK6c2cdF2LoyAQyMxWVuvPmuCiDWr7y+FrWCY3z4WB ZtCQ== X-Gm-Message-State: AOUpUlGgyOpwPetivSxLD4JRmILfsVEq7VBfOxLn/2ZmsPknycbqpxg0 9ZamJ5dQ9mE7+VXhJ367blcWq6gw X-Google-Smtp-Source: AAOMgpeDKgs0X3CqEUcVbvP6D9ByYYaErSn6fDidkCX9tFLEX2RlzvhYtvtrH6bDIQ9IjSVLSu1B5w== 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-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@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;