* [PATCH] hwmon: (occ) Mark occ_init_attribute() as __printf
@ 2026-02-03 16:34 Arnd Bergmann
2026-02-04 22:40 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2026-02-03 16:34 UTC (permalink / raw)
To: Guenter Roeck, Arnd Bergmann; +Cc: linux-hwmon, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
This is a printf-style function, which gcc -Werror=suggest-attribute=format
correctly points out:
drivers/hwmon/occ/common.c: In function 'occ_init_attribute':
drivers/hwmon/occ/common.c:761:9: error: function 'occ_init_attribute' might be a candidate for 'gnu_printf' format attribute [-Werror=suggest-attribute=format]
Add the attribute to avoid this warning and ensure any incorrect
format strings are detected here.
Fixes: 744c2fe950e9 ("hwmon: (occ) Rework attribute registration for stack usage")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/hwmon/occ/common.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
index b3694a4209b9..89928d38831b 100644
--- a/drivers/hwmon/occ/common.c
+++ b/drivers/hwmon/occ/common.c
@@ -749,6 +749,7 @@ static ssize_t occ_show_extended(struct device *dev,
* are dynamically allocated, we cannot use the existing kernel macros which
* stringify the name argument.
*/
+__printf(7, 8)
static void occ_init_attribute(struct occ_attribute *attr, int mode,
ssize_t (*show)(struct device *dev, struct device_attribute *attr, char *buf),
ssize_t (*store)(struct device *dev, struct device_attribute *attr,
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: (occ) Mark occ_init_attribute() as __printf
2026-02-03 16:34 [PATCH] hwmon: (occ) Mark occ_init_attribute() as __printf Arnd Bergmann
@ 2026-02-04 22:40 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2026-02-04 22:40 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Arnd Bergmann, linux-hwmon, linux-kernel
On Tue, Feb 03, 2026 at 05:34:36PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> This is a printf-style function, which gcc -Werror=suggest-attribute=format
> correctly points out:
>
> drivers/hwmon/occ/common.c: In function 'occ_init_attribute':
> drivers/hwmon/occ/common.c:761:9: error: function 'occ_init_attribute' might be a candidate for 'gnu_printf' format attribute [-Werror=suggest-attribute=format]
>
> Add the attribute to avoid this warning and ensure any incorrect
> format strings are detected here.
>
> Fixes: 744c2fe950e9 ("hwmon: (occ) Rework attribute registration for stack usage")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Applied.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-04 22:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03 16:34 [PATCH] hwmon: (occ) Mark occ_init_attribute() as __printf Arnd Bergmann
2026-02-04 22:40 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox