Re: [PATCH] hwmon: occ: rework attribute registration for stack usage

From: Guenter Roeck
Date: Tue Jun 10 2025 - 16:52:15 EST


On Tue, Jun 10, 2025 at 11:23:06AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@xxxxxxxx>
>
> 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@xxxxxxxx>

Applied.

Thanks,
Guenter