From nobody Fri Apr 3 02:58:09 2026 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 315DA248F6F for ; Tue, 24 Mar 2026 21:16:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774387013; cv=none; b=OwjIq4LBfP5RTO2S3jWFiJ9DTcgNqKKdOVYWSriyQR8/nFoLxJB9oYBhTiAuC3/RO7MuXirEoaGgWPu0LtVqWyPFKVK86iQJt8ashbv+X5DRAlchfaueQBoAXMz4NZvFgmEMIyvPvURhxfY4O0qp5sw/6w1U7QgzrpBSGjdoq38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774387013; c=relaxed/simple; bh=FppXID+0J4nDRs3X3TyPmxeAe0SJrDM6eTzwu4T3obM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=sk9ScZXsMUIWjY/TOxGzVyCnGeZQbmoE/Q+1ZSPldmABa9ayX4QJ26F5iRscLjN5bN6MXh0JTpn8dSksnNKwFYIfDNxEreV1aIWuxv7+TnLLlu+G2WBQSac5GLxtx/PxRFd2sxUGeoJJBDARUwse5swgj3+yPdXwISNzSkalzrE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=FkBQE7uJ; arc=none smtp.client-ip=209.85.222.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FkBQE7uJ" Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-8c70b5594f4so38767385a.1 for ; Tue, 24 Mar 2026 14:16:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774387010; x=1774991810; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sm/4nEkrkeSiZOQFxxtUg+CAIgNYlGGhCoF4Utum28A=; b=FkBQE7uJ2pMeTYgZBvq0jjU0PHytkjtlHvnq8TbcrwCDNvsW6GZ9OBJJhYWkP8uJ6k iy0lyvXzd5n+oLOqkqn4ZmrHY3A4TXM6vAbOQguS25iiQR7yENL+oJrtOMo209CwrieK 5viuE6J/TW+8nE3jOriw1UMHYHB77kBPZRJS8DKvoy7YFT8e757BkM7due+TxiRDEZYE 2dHZjRrQZwIjrmu1EKDr7dQ7Xwea/BhEoME4r2NcKpO6nRsIKe9GMDjaSC4r423kPQ0C LwkQ9hpFetckb/y4TSzh/KzAXiMtfljQqK+QHMCTky1rESz6Zmu9Y4snYSv3J1os3ktP 7qQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774387010; x=1774991810; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=sm/4nEkrkeSiZOQFxxtUg+CAIgNYlGGhCoF4Utum28A=; b=Xq031KtbGHIvHuwo87be99yUb8CN9q2dCY9Hr3A+TWSnxdx8P0qVzQIkA2EM/sBMJa s+eoJvHqIP/wcOa9YOf0z4XYmyeBhm16tymhv9t0QJXeS3++vr0fPbWzP3l5lWGj9s34 0AilCbqeY+z8HYvYoVZB6IK1Ti6mELJxPgdK2hX3I3Sqxab6UABGZk/0hK5jpPUKMH4R BGcTgRPwrYsdkTl54cGznsXd8Wn2YJSdbcOOSMRVw7i4xieSnlPfPCMND+EqHl0DuvD7 VSz6CaI5oy1sFMU4MXsoUUJmEKzqEeX12Ppu+V/elUBwbbJfVDUYkDR6gj9Y+iGKgpdM F0cw== X-Forwarded-Encrypted: i=1; AJvYcCWCFvRtBgIy20XyU9useLaumLaMKaMW1T2srGmGGsr7K4wgNv7JSbo7pugzMwGW9cWzBB/+HWAsUf0HUWw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8geeBj3GyMe/mlTseu5Hhp+srkkIqtp2NRnaxjdFQjYWyvNiL p0tZdsWv0AKOrHNcFyk/Ff6uIie5m6YyN0g3MTj1Tv1ZL6t2q9KaLj7y X-Gm-Gg: ATEYQzzAozU3lTPfPvJHhc/3J11bN7+1YQ4ZQ0S7QAhJHs0Ylo4ibEDOK5fp7B66Inj imVfjlF1e/GQqpfDY/HmrKgF8VIa7tZLbLRqJ7OQzJ2yMz4Zz7zDmrMBj/VAFDPcLbBN/f6gtbP XgRS8UqbWkBI9mXKb84HBgduz2kU+6FHMxvjK4RLEo8ATr5pUZcSeycdM3B4D946iMGjDZgPBJa LfbgxizQ6GNh11Vg1z4eEbxy8ixfWOYuc9IhZd/HjzTLDqfVp4JUxU48hnPR4ZibItbl5zPGh1Y N8Zfw6xoOEOIZdMAuvAIwoeH3Ah9MmD7z1SyhFXoZXMLhlb+kkIenqvuYAX2vOYQF5dy/eBKXwe n3Obo7yof1dYGwS3Q8wuAkRsglOT52/sNacYTYQTQVp56zzC6EpmE/xDGkWmAyWHi/8eB97i5jF nAKShkAVw8T0vvgVamUe05GcVyZfWnMGESCgEl7fLTQtTrGP8BosjU6Us= X-Received: by 2002:a05:620a:4149:b0:8cf:c4e1:9761 with SMTP id af79cd13be357-8d000561a93mr192888585a.20.1774387010169; Tue, 24 Mar 2026 14:16:50 -0700 (PDT) Received: from ryzen ([2601:644:8000:5b5d::8bd]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8cfc90bab92sm1117594685a.34.2026.03.24.14.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 14:16:49 -0700 (PDT) From: Rosen Penev To: linux-ide@vger.kernel.org Cc: Damien Le Moal , Niklas Cassel , Thierry Reding , Jonathan Hunter , linux-tegra@vger.kernel.org (open list:TEGRA ARCHITECTURE SUPPORT), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] ata: ahci_tegra: remove kcalloc Date: Tue, 24 Mar 2026 14:16:29 -0700 Message-ID: <20260324211629.26924-1-rosenp@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Combine allocations into one by using a flexible array member. Signed-off-by: Rosen Penev --- drivers/ata/ahci_tegra.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c index 44584eed6374..5972fe04ff3f 100644 --- a/drivers/ata/ahci_tegra.c +++ b/drivers/ata/ahci_tegra.c @@ -175,8 +175,9 @@ struct tegra_ahci_priv { struct reset_control *sata_cold_rst; /* Needs special handling, cannot use ahci_platform */ struct clk *sata_clk; - struct regulator_bulk_data *supplies; const struct tegra_ahci_soc *soc; + + struct regulator_bulk_data supplies[]; }; =20 static void tegra_ahci_handle_quirks(struct ahci_host_priv *hpriv) @@ -512,6 +513,7 @@ static const struct scsi_host_template ahci_platform_sh= t =3D { =20 static int tegra_ahci_probe(struct platform_device *pdev) { + const struct tegra_ahci_soc *soc; struct ahci_host_priv *hpriv; struct tegra_ahci_priv *tegra; struct resource *res; @@ -521,14 +523,15 @@ static int tegra_ahci_probe(struct platform_device *p= dev) if (IS_ERR(hpriv)) return PTR_ERR(hpriv); =20 - tegra =3D devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL); + soc =3D of_device_get_match_data(&pdev->dev); + tegra =3D devm_kzalloc(&pdev->dev, struct_size(tegra, supplies, soc->num_= supplies), GFP_KERNEL); if (!tegra) return -ENOMEM; =20 hpriv->plat_data =3D tegra; =20 tegra->pdev =3D pdev; - tegra->soc =3D of_device_get_match_data(&pdev->dev); + tegra->soc =3D soc; =20 tegra->sata_regs =3D devm_platform_ioremap_resource(pdev, 1); if (IS_ERR(tegra->sata_regs)) @@ -571,12 +574,6 @@ static int tegra_ahci_probe(struct platform_device *pd= ev) return PTR_ERR(tegra->sata_clk); } =20 - tegra->supplies =3D devm_kcalloc(&pdev->dev, - tegra->soc->num_supplies, - sizeof(*tegra->supplies), GFP_KERNEL); - if (!tegra->supplies) - return -ENOMEM; - regulator_bulk_set_supply_names(tegra->supplies, tegra->soc->supply_names, tegra->soc->num_supplies); --=20 2.53.0