]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: (occ) Mark occ_init_attribute() as __printf
authorArnd Bergmann <arnd@arndb.de>
Tue, 3 Feb 2026 16:34:36 +0000 (17:34 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 4 Feb 2026 22:40:36 +0000 (14:40 -0800)
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>
Link: https://lore.kernel.org/r/20260203163440.2674340-1-arnd@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/occ/common.c

index b3694a4209b975111a66ff470e5c25ba5ac3090c..89928d38831b612e911adfc9e87e5a75da4e552a 100644 (file)
@@ -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,