]> www.infradead.org Git - users/jedix/linux-maple.git/commit
hwmon: (occ) Rework attribute registration for stack usage
authorArnd Bergmann <arnd@arndb.de>
Tue, 10 Jun 2025 09:23:06 +0000 (11:23 +0200)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 16 Jun 2025 13:30:57 +0000 (06:30 -0700)
commit744c2fe950e936c4d62430de899d6253424200ed
treef4f98aafe9f5b74e471ac4af37ac89f8436e68a6
parent14c9ede9ca4cd078ad76a6ab9617b81074eb58bf
hwmon: (occ) Rework attribute registration for stack usage

clang produces an output with excessive stack usage when building the
occ_setup_sensor_attrs() function, apparently the result of having
a lot of struct literals and building with the -fno-strict-overflow
option that leads clang to skip some optimization in case the 'attr'
pointer overruns:

drivers/hwmon/occ/common.c:775:12: error: stack frame size (1392) exceeds limit (1280) in 'occ_setup_sensor_attrs' [-Werror,-Wframe-larger-than]

Replace the custom macros for initializing the attributes with a
simpler function call that does not run into this corner case.

Link: https://godbolt.org/z/Wf1Yx76a5
Fixes: 54076cb3b5ff ("hwmon (occ): Add sensor attributes and register hwmon device")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20250610092315.2640039-1-arnd@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/occ/common.c