[PATCH] btrfs: unify __printf and __cold annotations on error reporting definitions

From: Adrián García Casado

Date: Tue Oct 20 2026 - 20:05:45 EST


In fs/btrfs/messages.h, _btrfs_printk(), __btrfs_handle_fs_error(), and
__btrfs_panic() are all declared with both __printf() and __cold
attributes.

However, in fs/btrfs/messages.c, only _btrfs_printk() has both
__printf(3, 4) and __cold on its definition, while
__btrfs_handle_fs_error() and __btrfs_panic() only have __cold.

Add __printf(5, 6) to the definitions of __btrfs_handle_fs_error() and
__btrfs_panic() in fs/btrfs/messages.c so that all three functions have
consistent __printf() and __cold annotations on both their declarations
and definitions.

Suggested-by: David Sterba <dsterba@xxxxxxxx>
Signed-off-by: Adrián García Casado <adriangarciacasado42@xxxxxxxxx>
---
fs/btrfs/messages.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/messages.c b/fs/btrfs/messages.c
index 0704be7be..73acb69c3 100644
--- a/fs/btrfs/messages.c
+++ b/fs/btrfs/messages.c
@@ -116,7 +116,7 @@ const char * __attribute_const__ btrfs_decode_error(int error)
* Decodes expected errors from the caller and invokes the appropriate error
* response.
*/
-__cold
+__printf(5, 6) __cold
void __btrfs_handle_fs_error(struct btrfs_fs_info *fs_info, const char *function,
unsigned int line, int error, const char *fmt, ...)
{
@@ -276,7 +276,7 @@ void __cold btrfs_err_32bit_limit(struct btrfs_fs_info *fs_info)
* Decode unexpected, fatal errors from the caller, issue an alert, and either
* panic or BUGs, depending on mount options.
*/
-__cold
+__printf(5, 6) __cold
void __btrfs_panic(const struct btrfs_fs_info *fs_info, const char *function,
unsigned int line, int error, const char *fmt, ...)
{
--
2.56.0