From nobody Mon Jun 8 09:48:28 2026 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 453F8220F2A for ; Sat, 30 May 2026 00:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780101715; cv=none; b=F2CfCjq5sqxrNL68RbGA11B8t0bP9CrynVfbtMj1uQPsIwkgV5BJgb/HHVKAWuIjiBvumXBvMizoGFIX41Y7LVnDP+Y9+v5aiLGALZSfNRMhFKC+mDjweP1w4B/nsoY8F10QmVI6fEGSMZ+i714S4pAcl5PeZs6Aaikddxqdp1Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780101715; c=relaxed/simple; bh=jof8jAzXw0Rb5BCOmVEpdgEV9GpQ7Qgy8eSg3wcMZ1Q=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=sK+FWAcqgD002QkfqU8LDBPocaiNukI3M8XtX/oMdnnmUcEC5yc/rBTboNIVp3dgNN+9AkFY7lVscewSYtGIyOfEiy84rIqsJTX/djRBD5S8XXdIiuWriVRmB35x9p/30a9q66OnkGltXARsyDRi4HwVZMwqzAiGXW15+SWzzhk= 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=Kp0Wi/Q3; arc=none smtp.client-ip=209.85.214.169 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="Kp0Wi/Q3" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2bf114b0cf9so13188285ad.2 for ; Fri, 29 May 2026 17:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780101713; x=1780706513; 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=RQZwpWi6lhEFzRyzbt9FIh0qakqtgNCNAKMGR2a1m7A=; b=Kp0Wi/Q3xOpbb86vf5rL7j14l8oXeWUDYNfB7p8eSFIANhpjyNwPR+egNTfK50B1FZ DnXx2Pp7goJF/ssYaDaN4xkzQQO+dlkQg2TFbwhEKEHEDn/1SSFtMozVL6qzQk+OW+CS QegcHmpv85cVpthKXPNpo2//Sa7aHLe1xtMdnoBJDbmJeUsZ47HsMhH2NOllpO9JGGpa Ir7jEbuR1Z+BQ5vHeCvNJ5nS0d/NM8F7ca6Rtgxs3BBEa6k2BLJJVg/ENQPc7wHEqaWO VM8mq87Qw2HL3GoWxzYbffg2v2nEqivW19hhwlAwp+fFZ9g4y+46P6tcF2dMOSYt/67k Sarg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780101713; x=1780706513; 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=RQZwpWi6lhEFzRyzbt9FIh0qakqtgNCNAKMGR2a1m7A=; b=NvYcVX5ORGIApitKbE2EjD+q5hH+Q7n1JIWelq/WhFtf91Fn2qm8FRA1oZyd9gPOG9 Fd/PCnlaxc0w2Mqp0hjpqF1Dpoud/S7vxk09CmcuU/jym78/DGMhLUyoWOKDcZJPy2Fx xGMqXWph2WD5tLAXZdmHG5F44B7MyLwawQTXPX5zRQnvq5QuK0F4ybcmRTa8/PoAbnxM 4GsKIctPL+cWoooBz7+7Oc47H4SesMLGMDE5hKSYcQBt5w+A58XAfhJeXS+JRKS8JXKS 43XQBLvVDuIOGsWAjVKsMyxHpJGtmVZ79b9gye7vaLrw5fGDsqWnov1fRHHDsS2EyS4k SiTw== X-Forwarded-Encrypted: i=1; AFNElJ+Ha9b/SuOR1MCwBFNlpD6t3OyMtG0cGhJRV7fCD8OwAkrtjBehKmZME6DlOnNA2RhUsvg/Qo4cbfGEhFM=@vger.kernel.org X-Gm-Message-State: AOJu0YwQICOCEe6wJJtoCvarpINwpMXHvmOfZcGp3wrj+B7r9NZjZhIx BQ/HVASjZ51I4hrshYWWv0pcr6lVGMWsoSQpcuACbeAHP2UZjosHmtAP2Q2rwg== X-Gm-Gg: Acq92OGrpxaiFx9z1OSYYIo+XnTqu90FKaBawURbRhBpbYX/42uf+NzIQ5ocl7NlAOT J98ufOPUlJ32p1z8LkvT31CSRZ6hs+0xdQ4LMz2bAzzNT4ki0Z5VXVx3L51t7xqDObQcF2TmFJR C1wHsDYDtSTlYNpY11Mjj8TlC4yIYPiLuFL8+TX8M6ZpYJ8ft8VskVUeZF/elN/Ofx2+RXYdc1m NyizztLt4OZuaKobrFxkhZ5h1ani/k13A0E5rsLASkZBAXB0AaBPHMb/u0MaYxcLosS1ahm4dq3 e9iUf9OOpiLOAKqDMQQx6AcsGTG/PMQiTmfoQzRZxiItNyESMBzny9regIoB8szN55HC+lxor1C ORaI/6/e43X9t1kssNVl2n24Kbbm+KBlY2A5LIizNqomluppDHQ/qwB+yy1DCjO0BFgoJqPFc6T 2nJ0/Y2NuQFyooeD1VPvYCC4zKj7tpRY8AlrpyOe0aI4AN08JYUvgbPE762Vsrs24Cx6eMfzjIT 7KjZCZv/OPYrjO7lAgdFH1LR9lzz/QkJ6AdaTrksWvo0w== X-Received: by 2002:a17:903:2f8d:b0:2bf:23cf:3eb with SMTP id d9443c01a7336-2bf3684befemr22359245ad.28.1780101713376; Fri, 29 May 2026 17:41:53 -0700 (PDT) Received: from ryzen ([2601:644:8000:5b5d:7285:c2ff:fe45:8a32]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bf23a1e095sm34158365ad.32.2026.05.29.17.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 17:41:52 -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: [PATCHv2] ata: ahci_tegra: remove devm_kcalloc() Date: Fri, 29 May 2026 17:41:35 -0700 Message-ID: <20260530004135.43088-1-rosenp@gmail.com> X-Mailer: git-send-email 2.54.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 --- v2: Rebase 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 554f05e09f98..142ba2ae1c83 100644 --- a/drivers/ata/ahci_tegra.c +++ b/drivers/ata/ahci_tegra.c @@ -176,8 +176,9 @@ struct tegra_ahci_priv { /* Needs special handling, cannot use ahci_platform */ struct clk *sata_clk; struct tegra_pmc *pmc; - 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) @@ -514,6 +515,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; @@ -523,14 +525,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)) @@ -578,12 +581,6 @@ static int tegra_ahci_probe(struct platform_device *pd= ev) return dev_err_probe(&pdev->dev, PTR_ERR(tegra->pmc), "failed to get PMC\n"); =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.54.0