Re: [PATCH] ASoC: tegra: ADX: convert map to flexible array
Thierry Reding <[email protected]>
| Newsgroups | org.kernel.vger.linux-tegra,org.kernel.vger.linux-kernel,org.kernel.vger.linux-sound |
|---|---|
| Message-ID | <aoQ7SynywUKcIAaS@orome> |
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 <[email protected]> > --- > 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? Either way, though, this looks correct: Reviewed-by: Thierry Reding <[email protected]>
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAmqEPFcACgkQ3SOs138+ s6GwRw//bNdJ87iaPR43h9MA+iQvmN7luZ83EGxmzJSJkQMEn7RexGv3L4pkTTPQ jTsYbbaVoL+1x1o2O7iYFEjrxEyiVIHqKNMvdhFjfegZx79d4vzOJKsDPHZ/7on1 5lDJHZaxjHcVAtSZmOSm4sdcuucdR4DKTq3R5Evm49YvOS87U1F0Q2PeSVDqje4R h4qHeZKRuVUiZhJq5z9KrsxYVgCAiFkz+N3OpS9HSdeH4LIGjElRC0WonqQJaiQ1 gpGbYjFqSrWTSh4rlm7S9U124DvgIlD6nVZcOcpghCQ6ROtgXVn7KhhJaGJmbc6b O3uEQEbCC6w0KV+579blonaHEwUcV+69JyCWu2QpLBGH0771MFljfm4UKKYoqmfA MoUBGSbloVmIjAsJEZwbJ+QQ7D4X8mOEXqkXIe1g9NLqEy+1FO9fDF3z0DxyyilT WC/7Iv6X0a5MRMhfeDWOMebNFUU7tYXKXlObAzu7Fdu56X7hfXGvqeAO8IjyPAfw WLSYQv2wR74KDZVrbWwDGZWZ+wPMUMTzcCw/A7hqEF7OdUOCsacYgdDEtZUAFX2q bbykFyi5sb1WyUAElnqPip0cijOnGPYKKwFCFuzNnerlNaQ3Y5paRlpp+7qCcZ46 hJ/W+vJCN09IJzL8XBfzRSqceo/RkkJvlVjLXIZJhs49qMXhc9A= =AlDQ -----END PGP SIGNATURE-----