Commit 831a2b27 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Guenter Roeck
Browse files

hwmon: (occ) Mark occ_init_attribute() as __printf



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: 744c2fe9 ("hwmon: (occ) Rework attribute registration for stack usage")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20260203163440.2674340-1-arnd@kernel.org


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 52fb36a5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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,