mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rosen Penev" <rosenp@gmail.com>
To: "Thierry Reding" <thierry.reding@kernel.org>,
	"Rosen Penev" <rosenp@gmail.com>
Cc: <linux-sound@vger.kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.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] ASoC: tegra: ADX: convert map to flexible array
Date: Tue, 18 Aug 2026 13:33:45 -0700	[thread overview]
Message-ID: <DKSCUAP946RH.AXJJ9UJMW9CU@gmail.com> (raw)
In-Reply-To: <aoQ7SynywUKcIAaS@orome>

On Tue Aug 18, 2026 at 4:04 AM PDT, Thierry Reding wrote:
> On Fri, Aug 14, 2026 at 01:50:18PM -0700, Rosen Penev wrote:
>> Replace the pointer-based map allocation with a flexible array
>> member and use struct_size() for allocation. This simplifies
>> the code and avoid an extra allocation.
>>
>> Assisted-by: opencode:big-pickle
>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
>> ---
>>  sound/soc/tegra/tegra210_adx.c | 12 ++++--------
>>  sound/soc/tegra/tegra210_adx.h |  2 +-
>>  2 files changed, 5 insertions(+), 9 deletions(-)
>>
>> diff --git a/sound/soc/tegra/tegra210_adx.c b/sound/soc/tegra/tegra210_adx.c
>> index 9175598b52a7..d607ba4233b6 100644
>> --- a/sound/soc/tegra/tegra210_adx.c
>> +++ b/sound/soc/tegra/tegra210_adx.c
>> @@ -677,11 +677,13 @@ static int tegra210_adx_platform_probe(struct platform_device *pdev)
>>  	void __iomem *regs;
>>  	int err, i;
>>
>> -	adx = devm_kzalloc(dev, sizeof(*adx), GFP_KERNEL);
>> +	soc_data = of_device_get_match_data(dev);
>> +	adx = devm_kzalloc(dev,
>> +			   struct_size(adx, map, soc_data->ram_depth * TEGRA_ADX_SLOTS_PER_WORD),
>> +			   GFP_KERNEL);
>
> This is slightly hideous. Maybe add a temporary "count" variable for
> readability?
The reason for this is to allow a treewide conversion of this when
devm_kzalloc_flex() gets introduced.
>
> Either way, though, this looks correct:
>
> Reviewed-by: Thierry Reding <treding@nvidia.com>


  reply	other threads:[~2026-08-18 20:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-14 20:50 Rosen Penev
2026-08-18 11:04 ` Thierry Reding
2026-08-18 20:33   ` Rosen Penev [this message]
2026-08-20 10:20     ` Thierry Reding
2026-08-20 18:21       ` 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=DKSCUAP946RH.AXJJ9UJMW9CU@gmail.com \
    --to=rosenp@gmail.com \
    --cc=broonie@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=thierry.reding@kernel.org \
    --cc=tiwai@suse.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

all inboxes | Powered by JetHome®