From: Niklas Cassel <cassel@kernel.org>
To: Rosen Penev <rosenp@gmail.com>
Cc: linux-ide@vger.kernel.org, Damien Le Moal <dlemoal@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
"open list:TEGRA ARCHITECTURE SUPPORT"
<linux-tegra@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ata: ahci_tegra: remove kcalloc
Date: Wed, 25 Mar 2026 08:30:56 +0100 [thread overview]
Message-ID: <acOPMJVsxpBltqGX@ryzen> (raw)
In-Reply-To: <20260324211629.26924-1-rosenp@gmail.com>
Hello Rosen,
subject is a bit misleading:
"remove kcalloc"
you are removing devm_kcalloc(), so device managed.
On Tue, Mar 24, 2026 at 02:16:29PM -0700, Rosen Penev wrote:
> Combine allocations into one by using a flexible array member.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> 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[];
Personally I'm not a big fan of flexible array members, as there can be
only one. And if you use it you want to use counted_by().
Yes, there are two device managed allocations. But is that so bad?
Since it is device managed, it will get freed on device removal anyway.
Kind regards,
Niklas
next prev parent reply other threads:[~2026-03-25 7:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-24 21:16 [PATCH] ata: ahci_tegra: remove kcalloc Rosen Penev
2026-03-24 22:10 ` Damien Le Moal
2026-03-24 22:51 ` Rosen Penev
2026-03-25 7:30 ` Niklas Cassel [this message]
2026-03-25 10:17 ` Jon Hunter
2026-03-25 23:29 ` Rosen Penev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=acOPMJVsxpBltqGX@ryzen \
--to=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=rosenp@gmail.com \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox