diff options
| author | Rosen Penev <rosenp@gmail.com> | 2026-03-31 00:35:28 +0300 |
|---|---|---|
| committer | Kevin Hilman (TI) <khilman@baylibre.com> | 2026-05-11 19:51:01 +0300 |
| commit | 2a7a9e20b9e8b5dc4fdef777e67d390dcb3a8ea4 (patch) | |
| tree | 45fb83095447f9f53ca32a6b148ef9903b8fe270 /include/linux | |
| parent | 254f49634ee16a731174d2ae34bc50bd5f45e731 (diff) | |
| download | linux-2a7a9e20b9e8b5dc4fdef777e67d390dcb3a8ea4.tar.xz | |
ARM: omap2: simplify allocation for omap_device
Use a flexible array member (FAM) to combine hwmods array allocation
with the omap_device structure. This reduces the number of allocations
from two separate calls (one for the device, one for the array) to a
single allocation, improving efficiency and reducing memory fragmentation.
The FAM approach also enables bounds checking through __counted_by(),
which provides runtime verification that array accesses stay within
the allocated size. This improves security and helps catch bugs during
development.
Simplify error handling by removing the unnecessary multi-label goto
pattern. The new code is more straightforward: allocate, verify, copy
data, and either return success or error immediately.
Also removes the now-redundant kfree(od->hwmods) in omap_device_delete()
since the hwmods array is now embedded in the structure rather than
separately allocated.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260330213528.18187-1-rosenp@gmail.com
Signed-off-by: Kevin Hilman (TI) <khilman@baylibre.com>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
