[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250830135833.112327-1-rongqianfeng@vivo.com>
Date: Sat, 30 Aug 2025 21:58:33 +0800
From: Qianfeng Rong <rongqianfeng@...o.com>
To: Kent Overstreet <kent.overstreet@...ux.dev>,
linux-bcachefs@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Qianfeng Rong <rongqianfeng@...o.com>
Subject: [PATCH] bcachefs: Use int type to store negative error codes
Change the 'ret' variable in __bch2_dev_attach_bdev() from unsigned to
int, as it needs to store either negative error codes or zero.
Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but can be confusing. Additionally, assigning negative error
codes to unsigned type may trigger a GCC warning when the -Wsign-conversion
flag is enabled.
No effect on runtime.
Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
---
fs/bcachefs/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 793c16fa8b09..ec20ab0ad84e 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -1769,7 +1769,7 @@ static int bch2_dev_alloc(struct bch_fs *c, unsigned dev_idx)
static int __bch2_dev_attach_bdev(struct bch_dev *ca, struct bch_sb_handle *sb,
struct printbuf *err)
{
- unsigned ret;
+ int ret;
if (bch2_dev_is_online(ca)) {
prt_printf(err, "already have device online in slot %u\n",
--
2.34.1
Powered by blists - more mailing lists