drivers/i2c/i2c-core-base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
When compile with CONFIG_FRAME_WARN=1024, there can be a warning:
drivers/i2c/i2c-core-base.c: In function ‘i2c_detect.isra’:
drivers/i2c/i2c-core-base.c:2507:1: warning: the frame size of 1028 bytes
is larger than 1024 bytes [-Wframe-larger-than=].
2507 | }
| ^
Mark i2c_detect_address() noinline_for_stack to avoid this warning.
Signed-off-by: Su Hui <suhui@nfschina.com>
---
ps: found this warning during running randconfig test.
drivers/i2c/i2c-core-base.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 5546184df05f..59983d2a9cca 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -2405,8 +2405,8 @@ static int i2c_default_probe(struct i2c_adapter *adap, unsigned short addr)
return err >= 0;
}
-static int i2c_detect_address(struct i2c_client *temp_client,
- struct i2c_driver *driver)
+static noinline_for_stack int i2c_detect_address(struct i2c_client *temp_client,
+ struct i2c_driver *driver)
{
struct i2c_board_info info;
struct i2c_adapter *adapter = temp_client->adapter;
--
2.30.2
Hi Sui,
On Mon, 10 Feb 2025 at 09:03, Su Hui <suhui@nfschina.com> wrote:
> When compile with CONFIG_FRAME_WARN=1024, there can be a warning:
>
> drivers/i2c/i2c-core-base.c: In function ‘i2c_detect.isra’:
> drivers/i2c/i2c-core-base.c:2507:1: warning: the frame size of 1028 bytes
> is larger than 1024 bytes [-Wframe-larger-than=].
> 2507 | }
> | ^
>
> Mark i2c_detect_address() noinline_for_stack to avoid this warning.
>
> Signed-off-by: Su Hui <suhui@nfschina.com>
I have posted an alternative fix:
"[PATCH] i2c: core: Allocate temporary client dynamically"
https://lore.kernel.org/f9aa39362e918b62aec0567f899b37d8d3c44710.1740064176.git.geert+renesas@glider.be/
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
© 2016 - 2026 Red Hat, Inc.