Skip to content

Commit 831a2b2

Browse files
arndbgroeck
authored andcommitted
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: 744c2fe ("hwmon: (occ) Rework attribute registration for stack usage") Signed-off-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 52fb36a commit 831a2b2

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/hwmon/occ/common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@ static ssize_t occ_show_extended(struct device *dev,
749749
* are dynamically allocated, we cannot use the existing kernel macros which
750750
* stringify the name argument.
751751
*/
752+
__printf(7, 8)
752753
static void occ_init_attribute(struct occ_attribute *attr, int mode,
753754
ssize_t (*show)(struct device *dev, struct device_attribute *attr, char *buf),
754755
ssize_t (*store)(struct device *dev, struct device_attribute *attr,

0 commit comments

Comments
 (0)