fs/bcachefs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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@vivo.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
On Sat, Aug 30, 2025 at 09:58:33PM +0800, Qianfeng Rong wrote: > 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@vivo.com> Thanks, applied > --- > 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 >
© 2016 - 2025 Red Hat, Inc.